All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Beller <stefanbeller@googlemail.com>
To: Michael Haggerty <mhagger@alum.mit.edu>,
	Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 3/3] cmd_repack(): remove redundant local variable "nr_packs"
Date: Tue, 17 Dec 2013 14:46:53 +0100	[thread overview]
Message-ID: <52B055CD.9040905@googlemail.com> (raw)
In-Reply-To: <1387287838-25779-4-git-send-email-mhagger@alum.mit.edu>

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@alum.mit.edu>

Acked-by: Stefan Beller <stefanbeller@googlemail.com>

> ---
> 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");
>  
>  	/*
> 

      reply	other threads:[~2013-12-17 13:47 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-17 13:43 [PATCH 0/3] Fix two buffer overflows and remove a redundant var Michael Haggerty
2013-12-17 13:43 ` [PATCH 1/3] prune-packed: fix a possible buffer overflow Michael Haggerty
2013-12-17 13:57   ` Duy Nguyen
2013-12-17 18:43     ` Junio C Hamano
2013-12-18 22:44       ` Michael Haggerty
2013-12-19  0:04         ` Jeff King
2013-12-19 16:33           ` Michael Haggerty
2013-12-20  9:30             ` Jeff King
2013-12-19  0:37       ` Duy Nguyen
2013-12-17 13:43 ` [PATCH 2/3] prune_object_dir(): verify that path fits in the temporary buffer Michael Haggerty
2013-12-17 18:51   ` Junio C Hamano
2013-12-17 23:22     ` Jeff King
2013-12-18 19:35       ` Junio C Hamano
2013-12-18 20:00         ` Jeff King
2013-12-18 20:07           ` Junio C Hamano
2013-12-18 20:11             ` Jeff King
2013-12-18 20:15               ` Junio C Hamano
2013-12-18 20:27                 ` Jeff King
2013-12-17 18:56   ` Antoine Pelisse
2013-12-17 13:43 ` [PATCH 3/3] cmd_repack(): remove redundant local variable "nr_packs" Michael Haggerty
2013-12-17 13:46   ` Stefan Beller [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52B055CD.9040905@googlemail.com \
    --to=stefanbeller@googlemail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mhagger@alum.mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.