Re: [PATCH 3/3] cmd_repack(): remove redundant local variable "nr_packs"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 17.12.2013 14:43, Michael Haggerty wrote:
> Its value is the same as the number of entries in the "names"
> string_list, so just use "names.nr" in its place.
> 
> Signed-off-by: Michael Haggerty <mhagger@xxxxxxxxxxxx>

Acked-by: Stefan Beller <stefanbeller@xxxxxxxxxxxxxx>

> ---
> This is just a trivial simplification.  Take it or leave it.
> 
>  builtin/repack.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/builtin/repack.c b/builtin/repack.c
> index a0ff5c7..91e2363 100644
> --- a/builtin/repack.c
> +++ b/builtin/repack.c
> @@ -123,7 +123,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
>  	struct string_list rollback = STRING_LIST_INIT_NODUP;
>  	struct string_list existing_packs = STRING_LIST_INIT_DUP;
>  	struct strbuf line = STRBUF_INIT;
> -	int nr_packs, ext, ret, failed;
> +	int ext, ret, failed;
>  	FILE *out;
>  
>  	/* variables to be filled by option parsing */
> @@ -233,13 +233,11 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
>  	if (ret)
>  		return ret;
>  
> -	nr_packs = 0;
>  	out = xfdopen(cmd.out, "r");
>  	while (strbuf_getline(&line, out, '\n') != EOF) {
>  		if (line.len != 40)
>  			die("repack: Expecting 40 character sha1 lines only from pack-objects.");
>  		string_list_append(&names, line.buf);
> -		nr_packs++;
>  	}
>  	fclose(out);
>  	ret = finish_command(&cmd);
> @@ -247,7 +245,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
>  		return ret;
>  	argv_array_clear(&cmd_args);
>  
> -	if (!nr_packs && !quiet)
> +	if (!names.nr && !quiet)
>  		printf("Nothing new to pack.\n");
>  
>  	/*
> 

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]