Re: [PATCH v2] builtin/rm.c: Use ALLOC_GROW instead of alloc_nr and xrealloc.

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

 



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

On Sun, Dec 19, 2010 at 9:56 AM, Thiago Farina <tfransosi@xxxxxxxxx> wrote:
> Signed-off-by: Thiago Farina <tfransosi@xxxxxxxxx>
> ---
> Â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
>
>
--
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]