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>
This commit is contained in:
parent
fcbc0d8e82
commit
834d9eb6b7
12
builtin/rm.c
12
builtin/rm.c
@ -20,15 +20,6 @@ static struct {
|
|||||||
const char **name;
|
const char **name;
|
||||||
} list;
|
} 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)
|
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];
|
struct cache_entry *ce = active_cache[i];
|
||||||
if (!match_pathspec(pathspec, ce->name, ce_namelen(ce), 0, seen))
|
if (!match_pathspec(pathspec, ce->name, ce_namelen(ce), 0, seen))
|
||||||
continue;
|
continue;
|
||||||
add_list(ce->name);
|
ALLOC_GROW(list.name, list.nr + 1, list.alloc);
|
||||||
|
list.name[list.nr++] = ce->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pathspec) {
|
if (pathspec) {
|
||||||
|
Loading…
Reference in New Issue
Block a user