diff options
author | René Scharfe <l.s.r@web.de> | 2014-06-01 13:07:21 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-06-02 13:51:22 -0700 |
commit | fb79947487b628ec82bc0ad46a08629539a59091 (patch) | |
tree | 724023ca801aff9dea72ea6f4777c1d6767f5be8 /t/t9601/cvsroot/module/imported-anonymously.txt,v | |
parent | Sync with 1.9.4 (diff) | |
download | tgif-fb79947487b628ec82bc0ad46a08629539a59091.tar.xz |
pack-objects: use free()+xcalloc() instead of xrealloc()+memset()
Whenever the hash table becomes too small then its size is increased,
the original part (and the added space) is zerod out using memset(),
and the table is rebuilt from scratch.
Simplify this proceess by returning the old memory using free() and
allocating the new buffer using xcalloc(), which already clears the
buffer for us. That way we avoid copying the old hash table contents
needlessly inside xrealloc().
While at it, use the first array member with sizeof instead of a
specific type. The old code used uint32_t and int, while index is
actually an array of int32_t. Their sizes are the same basically
everywhere, so it's not actually a problem, but the new code is
cleaner and doesn't have to be touched should the type be changed.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9601/cvsroot/module/imported-anonymously.txt,v')
0 files changed, 0 insertions, 0 deletions