git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thiago Farina <tfransosi@gmail.com>
To: git@vger.kernel.org
Cc: pclouds@gmail.com, Jonathan Nieder <jrnieder@gmail.com>
Subject: Re: [PATCH v2] builtin/rm.c: Use ALLOC_GROW instead of alloc_nr and xrealloc.
Date: Sun, 19 Dec 2010 09:58:19 -0200	[thread overview]
Message-ID: <AANLkTim-zv6WZZ_DErnoNBhgJw3DnC0jHSH-Mg2CzkhV@mail.gmail.com> (raw)
In-Reply-To: <97af5e0255d234e3a7ec5df1e387bec39ed94206.1292759580.git.tfransosi@gmail.com>

Forgot to copy Jonathan when using 'git send-email'. Now copying him.

On Sun, Dec 19, 2010 at 9:56 AM, Thiago Farina <tfransosi@gmail.com> wrote:
> Signed-off-by: Thiago Farina <tfransosi@gmail.com>
> ---
>  Changes from v1:
>  - Remove the add_list function since it's used only once per Nguyen Thai Ngoc Duy
>   review.
>
>  builtin/rm.c |   12 ++----------
>  1 files changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/builtin/rm.c b/builtin/rm.c
> index c7b7bb3..ff491d7 100644
> --- a/builtin/rm.c
> +++ b/builtin/rm.c
> @@ -20,15 +20,6 @@ static struct {
>        const char **name;
>  } list;
>
> -static void add_list(const char *name)
> -{
> -       if (list.nr >= list.alloc) {
> -               list.alloc = alloc_nr(list.alloc);
> -               list.name = xrealloc(list.name, list.alloc * sizeof(const char *));
> -       }
> -       list.name[list.nr++] = name;
> -}
> -
>  static int check_local_mod(unsigned char *head, int index_only)
>  {
>        /*
> @@ -182,7 +173,8 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
>                struct cache_entry *ce = active_cache[i];
>                if (!match_pathspec(pathspec, ce->name, ce_namelen(ce), 0, seen))
>                        continue;
> -               add_list(ce->name);
> +               ALLOC_GROW(list.name, list.nr + 1, list.alloc);
> +               list.name[list.nr++] = ce->name;
>        }
>
>        if (pathspec) {
> --
> 1.7.3.2.343.g7d43d
>
>

      reply	other threads:[~2010-12-19 11:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-14  1:48 [PATCH] builtin/rm.c: Use ALLOC_GROW instead of alloc_nr and xrealloc Thiago Farina
2010-12-18 23:03 ` Thiago Farina
2010-12-19  3:02 ` Nguyen Thai Ngoc Duy
2010-12-19 11:56   ` [PATCH v2] " Thiago Farina
2010-12-19 11:58     ` Thiago Farina [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=AANLkTim-zv6WZZ_DErnoNBhgJw3DnC0jHSH-Mg2CzkhV@mail.gmail.com \
    --to=tfransosi@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=pclouds@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).