Skip to content

Commit

Permalink
Fix ALLOC_GROW calls with obsolete semantics
Browse files Browse the repository at this point in the history
ALLOC_GROW now expects the 'nr' argument to be "how much you
want" and not "how much you have". This fixes all cases
where we weren't previously adding anything to the 'nr'.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Jun 17, 2007
1 parent 1a15fed commit 25fd2f7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ struct dir_entry *dir_add_name(struct dir_struct *dir, const char *pathname, int
if (cache_name_pos(pathname, len) >= 0)
return NULL;

ALLOC_GROW(dir->entries, dir->nr, dir->alloc);
ALLOC_GROW(dir->entries, dir->nr+1, dir->alloc);
return dir->entries[dir->nr++] = dir_entry_new(pathname, len);
}

Expand All @@ -295,7 +295,7 @@ struct dir_entry *dir_add_ignored(struct dir_struct *dir, const char *pathname,
if (cache_name_pos(pathname, len) >= 0)
return NULL;

ALLOC_GROW(dir->ignored, dir->ignored_nr, dir->ignored_alloc);
ALLOC_GROW(dir->ignored, dir->ignored_nr+1, dir->ignored_alloc);
return dir->ignored[dir->ignored_nr++] = dir_entry_new(pathname, len);
}

Expand Down

0 comments on commit 25fd2f7

Please sign in to comment.