diff mbox series

[v9,1/8] lib/cmdline.c: remove quotes symmetrically

Message ID 151075900967.14434.2860376398321506569.stgit@hbathini.in.ibm.com (mailing list archive)
State Changes Requested
Headers show
Series reduce memory consumption for powerpc firmware-assisted capture kernel | expand

Commit Message

Hari Bathini Nov. 15, 2017, 3:16 p.m. UTC
From: Michal Suchanek <msuchanek@suse.de>

Remove quotes from argument value only if there is qoute on both sides.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
 lib/cmdline.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

Michal Suchánek Dec. 15, 2017, 8:51 p.m. UTC | #1
On Wed, 15 Nov 2017 20:46:56 +0530
Hari Bathini <hbathini@linux.vnet.ibm.com> wrote:

> From: Michal Suchanek <msuchanek@suse.de>
> 
> Remove quotes from argument value only if there is qoute on both
> sides.
> 
> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> ---
>  lib/cmdline.c |   10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/lib/cmdline.c b/lib/cmdline.c
> index 171c19b..6d398a8 100644
> --- a/lib/cmdline.c
> +++ b/lib/cmdline.c
> @@ -227,14 +227,12 @@ char *next_arg(char *args, char **param, char
> **val) *val = args + equals + 1;
>  
>  		/* Don't include quotes in value. */
> -		if (**val == '"') {
> -			(*val)++;
> -			if (args[i-1] == '"')
> -				args[i-1] = '\0';
> +		if ((args[i-1] == '"') && ((quoted) || (**val ==
> '"'))) {
> +			args[i-1] = '\0';
> +			if (!quoted)
> +				(*val)++;
>  		}
>  	}
> -	if (quoted && args[i-1] == '"')
> -		args[i-1] = '\0';
>  
>  	if (args[i]) {
>  		args[i] = '\0';
> 

This was only useful as separate patch with the incremental fadump
update. Since the fadump update is squashed in this refresh series this
can be squashed with the following lib/cmdline patch as well.

Thanks

Michal
diff mbox series

Patch

diff --git a/lib/cmdline.c b/lib/cmdline.c
index 171c19b..6d398a8 100644
--- a/lib/cmdline.c
+++ b/lib/cmdline.c
@@ -227,14 +227,12 @@  char *next_arg(char *args, char **param, char **val)
 		*val = args + equals + 1;
 
 		/* Don't include quotes in value. */
-		if (**val == '"') {
-			(*val)++;
-			if (args[i-1] == '"')
-				args[i-1] = '\0';
+		if ((args[i-1] == '"') && ((quoted) || (**val == '"'))) {
+			args[i-1] = '\0';
+			if (!quoted)
+				(*val)++;
 		}
 	}
-	if (quoted && args[i-1] == '"')
-		args[i-1] = '\0';
 
 	if (args[i]) {
 		args[i] = '\0';