Fix ALLOC_GROW calls with obsolete semantics
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>
Jeff King committed
Jun 16, 2007 at 18:43 UTC
25fd2f7a310df17dca298a3acf2aba716ceb8ce3
1 file changed
+2
-2
dir.c
+2
-2
@@ -286,7 +286,7 @@ struct dir_entry *dir_add_name(struct dir_struct *dir, const char *pathname, int
286
if (cache_name_pos(pathname, len) >= 0)
287
return NULL;
288
289
- ALLOC_GROW(dir->entries, dir->nr, dir->alloc);
289
+ ALLOC_GROW(dir->entries, dir->nr+1, dir->alloc);
290
return dir->entries[dir->nr++] = dir_entry_new(pathname, len);
291
}
292
@@ -295,7 +295,7 @@ struct dir_entry *dir_add_ignored(struct dir_struct *dir, const char *pathname,
295
if (cache_name_pos(pathname, len) >= 0)
296
return NULL;
297
298
- ALLOC_GROW(dir->ignored, dir->ignored_nr, dir->ignored_alloc);
298
+ ALLOC_GROW(dir->ignored, dir->ignored_nr+1, dir->ignored_alloc);
299
return dir->ignored[dir->ignored_nr++] = dir_entry_new(pathname, len);
300
}
301