summaryrefslogtreecommitdiff
path: root/builtin/rm.c
diff options
context:
space:
mode:
authorThiago Farina <tfransosi@gmail.com>2010-12-19 09:56:25 -0200
committerJunio C Hamano <gitster@pobox.com>2010-12-19 10:44:06 -0800
commit834d9eb6b70a3447c2ad514f9c0e052bc43e8c8a (patch)
treec590a172c1f2c0ac709c946f523c97e1551bb05f /builtin/rm.c
parentfcbc0d8e8216d7b6235eccf9f3b556455ad3be3d (diff)
downloadgit-834d9eb6b70a3447c2ad514f9c0e052bc43e8c8a.tar.gz
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>
Diffstat (limited to 'builtin/rm.c')
-rw-r--r--builtin/rm.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/builtin/rm.c b/builtin/rm.c
index c7b7bb37a2..ff491d7761 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) {