Skip to content

Commit

Permalink
sha1_file.c: use ALLOC_GROW() in pretend_sha1_file()
Browse files Browse the repository at this point in the history
Helped-by: He Sun <sunheehnus@gmail.com>
Signed-off-by: Dmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Dmitry S. Dolzhenko authored and Junio C Hamano committed Mar 3, 2014
1 parent 999f566 commit c735396
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions sha1_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -2626,12 +2626,7 @@ int pretend_sha1_file(void *buf, unsigned long len, enum object_type type,
hash_sha1_file(buf, len, typename(type), sha1);
if (has_sha1_file(sha1) || find_cached_object(sha1))
return 0;
if (cached_object_alloc <= cached_object_nr) {
cached_object_alloc = alloc_nr(cached_object_alloc);
cached_objects = xrealloc(cached_objects,
sizeof(*cached_objects) *
cached_object_alloc);
}
ALLOC_GROW(cached_objects, cached_object_nr + 1, cached_object_alloc);
co = &cached_objects[cached_object_nr++];
co->size = len;
co->type = type;
Expand Down

0 comments on commit c735396

Please sign in to comment.