[PATCH:xcursorgen] Fix -image argument parsing to not shadow "i" variable

Jeremy Huddleston jeremyhu at apple.com
Thu Feb 16 22:44:56 PST 2012


Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

On Feb 14, 2012, at 7:56 PM, Alan Coopersmith <alan.coopersmith at oracle.com> wrote:

> Also avoids starting at the wrong argument if -image is not the first
> flag passed to xcompmgr (though that's not really supported in the
> current syntax).
> 
> Fixes gcc warning:
> xcursorgen.c: In function `main':
> xcursorgen.c:394: warning: declaration of 'i' shadows a previous local
> xcursorgen.c:377: warning: shadowed declaration is here
> 
> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
> ---
> xcursorgen.c |    4 +---
> 1 files changed, 1 insertions(+), 3 deletions(-)
> 
> diff --git a/xcursorgen.c b/xcursorgen.c
> index 195d6f6..fd41a77 100644
> --- a/xcursorgen.c
> +++ b/xcursorgen.c
> @@ -391,13 +391,11 @@ main (int argc, char *argv[])
>         }
>       if (strcmp (argv[i], "-image") == 0)
>         {
> -	  int i = 2;
> 	  int ret = 0;
> -	  while (argv[i])
> +	  while (argv[++i])
> 	  {
> 	    if (check_image (argv[i]))
> 	      ret = i;
> -	    i++;
> 	  }
> 	  return ret;
> 	}
> -- 
> 1.7.3.2
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 



More information about the xorg-devel mailing list