@matheusbsbs / matheus-bagliano / commits / 834d9eb6b7
Fork 0

builtin/rm.c: Use ALLOC_GROW instead of alloc_nr and xrealloc.

Signed-off-by: Thiago Farina <tfransosi@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Thiago Farina committed Dec 19, 2010 at 09:56 UTC 834d9eb6b70a3447c2ad514f9c0e052bc43e8c8a
1 file changed +2 -10
builtin/rm.c
+2 -10
@@ -20,15 +20,6 @@ static struct {
20 const char **name;
21 } list;
22
23 -static void add_list(const char *name)
24 -{
25 - if (list.nr >= list.alloc) {
26 - list.alloc = alloc_nr(list.alloc);
27 - list.name = xrealloc(list.name, list.alloc * sizeof(const char *));
28 - }
29 - list.name[list.nr++] = name;
30 -}
31 -
23 static int check_local_mod(unsigned char *head, int index_only)
24 {
25 /*
@@ -182,7 +173,8 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
173 struct cache_entry *ce = active_cache[i];
174 if (!match_pathspec(pathspec, ce->name, ce_namelen(ce), 0, seen))
175 continue;
185 - add_list(ce->name);
176 + ALLOC_GROW(list.name, list.nr + 1, list.alloc);
177 + list.name[list.nr++] = ce->name;
178 }
179
180 if (pathspec) {