Merge branch 'rs/realloc-array'

Code cleanup.

* rs/realloc-array:
  use REALLOC_ARRAY for changing the allocation size of arrays
  add macro REALLOC_ARRAY
This commit is contained in:
Junio C Hamano
2014-09-26 14:39:45 -07:00
28 changed files with 45 additions and 70 deletions

View File

@ -1170,9 +1170,7 @@ static void conclude_pack(int fix_thin_pack, const char *curr_pack, unsigned cha
int nr_objects_initial = nr_objects;
if (nr_unresolved <= 0)
die(_("confusion beyond insanity"));
objects = xrealloc(objects,
(nr_objects + nr_unresolved + 1)
* sizeof(*objects));
REALLOC_ARRAY(objects, nr_objects + nr_unresolved + 1);
memset(objects + nr_objects + 1, 0,
nr_unresolved * sizeof(*objects));
f = sha1fd(output_fd, curr_pack);