From: Junio C Hamano Date: Thu, 11 Aug 2011 17:53:09 GMT Subject: [PATCH 04/11] object: next_size() helper for readability Message-ID: <1313085196-13249-5-git-send-email-gitster@pobox.com> In-Reply-To: <1313085196-13249-1-git-send-email-gitster@pobox.com> Move the heuristics to grow the table size into a separate helper function to make the caller more readable. Signed-off-by: Junio C Hamano --- object.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/object.c b/object.c index 4ff2d7d..259a67e 100644 --- a/object.c +++ b/object.c @@ -81,10 +81,15 @@ struct object *lookup_object(const unsigned char *sha1) return obj; } +static int next_size(int sz) +{ + return sz < 32 ? 32 : 2 * sz; +} + static void grow_object_hash(void) { int i; - int new_hash_size = obj_hash_size < 32 ? 32 : 2 * obj_hash_size; + int new_hash_size = next_size(obj_hash_size); struct object **new_hash; new_hash = xcalloc(new_hash_size, sizeof(struct object *)); -- 1.7.6.433.g1421f