git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] builtin/rm.c: Use ALLOG_GROW instead of alloc_nr and xrealloc.
@ 2010-12-14  1:37 Thiago Farina
  2010-12-14  1:56 ` Thiago Farina
  0 siblings, 1 reply; 2+ messages in thread
From: Thiago Farina @ 2010-12-14  1:37 UTC (permalink / raw)
  To: git

Signed-off-by: Thiago Farina <tfransosi@gmail.com>
---
 builtin/rm.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/builtin/rm.c b/builtin/rm.c
index c7b7bb3..faeedfc 100644
--- a/builtin/rm.c
+++ b/builtin/rm.c
@@ -22,10 +22,7 @@ static struct {
 
 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 *));
-	}
+	ALLOC_GROW(list.name, list.nr + 1, list.alloc);
 	list.name[list.nr++] = name;
 }
 
-- 
1.7.3.2.343.g7d43d

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] builtin/rm.c: Use ALLOG_GROW instead of alloc_nr and xrealloc.
  2010-12-14  1:37 [PATCH] builtin/rm.c: Use ALLOG_GROW instead of alloc_nr and xrealloc Thiago Farina
@ 2010-12-14  1:56 ` Thiago Farina
  0 siblings, 0 replies; 2+ messages in thread
From: Thiago Farina @ 2010-12-14  1:56 UTC (permalink / raw)
  To: git

On Mon, Dec 13, 2010 at 11:37 PM, Thiago Farina <tfransosi@gmail.com> wrote:
> Signed-off-by: Thiago Farina <tfransosi@gmail.com>
> ---
>  builtin/rm.c |    5 +----
>  1 files changed, 1 insertions(+), 4 deletions(-)
>
> diff --git a/builtin/rm.c b/builtin/rm.c
> index c7b7bb3..faeedfc 100644
> --- a/builtin/rm.c
> +++ b/builtin/rm.c
> @@ -22,10 +22,7 @@ static struct {
>
>  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 *));
> -       }
> +       ALLOC_GROW(list.name, list.nr + 1, list.alloc);
>        list.name[list.nr++] = name;
>  }
>

Disregard this, as I made a typo in the subject. Sent another patch
with the subject typo fixed. Thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-12-14  1:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-14  1:37 [PATCH] builtin/rm.c: Use ALLOG_GROW instead of alloc_nr and xrealloc Thiago Farina
2010-12-14  1:56 ` Thiago Farina

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).