[PATCH 1/3] tail: turn i to unsigned integer

walter harms wharms at bfs.de
Sat Jul 26 18:02:38 UTC 2014


what is the advantage ?

re,
 wh

Am 26.07.2014 19:37, schrieb Guilherme Maciel Ferreira:
> The variable i is used only to index and to be assigned to other unsigned
> integers.
> 
> Signed-off-by: Guilherme Maciel Ferreira <guilherme.maciel.ferreira at gmail.com>
> ---
>  coreutils/tail.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/coreutils/tail.c b/coreutils/tail.c
> index e352ab6..c44aeb8 100644
> --- a/coreutils/tail.c
> +++ b/coreutils/tail.c
> @@ -100,7 +100,8 @@ int tail_main(int argc, char **argv)
>  	size_t tailbufsize;
>  	unsigned header_threshhold = 1;
>  	unsigned nfiles;
> -	int i, opt;
> +	unsigned i;
> +	int opt;
>  
>  	int *fds;
>  	const char *fmt;
> @@ -161,7 +162,7 @@ int tail_main(int argc, char **argv)
>  		}
>  		fds[nfiles] = fd;
>  		argv[nfiles++] = argv[i];
> -	} while (++i < argc);
> +	} while (++i < (unsigned) argc);
>  
>  	if (!nfiles)
>  		bb_error_msg_and_die("no files");


More information about the busybox mailing list