Web lists-archives.com

[PATCH 083/194] object: add repository argument to grow_object_hash




From: Jonathan Nieder <jrnieder@xxxxxxxxx>

Add a repository argument to allow the caller of grow_object_hash to
be more specific about which repository to handle. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.

As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.

Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx>
---
 object.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/object.c b/object.c
index 681fa40eb1..225679188b 100644
--- a/object.c
+++ b/object.c
@@ -115,7 +115,8 @@ struct object *lookup_object_the_repository(const unsigned char *sha1)
  * power of 2 (but at least 32).  Copy the existing values to the new
  * hash map.
  */
-static void grow_object_hash(void)
+#define grow_object_hash(r) grow_object_hash_##r()
+static void grow_object_hash_the_repository(void)
 {
 	int i;
 	/*
@@ -146,7 +147,7 @@ void *create_object_the_repository(const unsigned char *sha1, void *o)
 	hashcpy(obj->oid.hash, sha1);
 
 	if (the_repository->parsed_objects.obj_hash_size - 1 <= the_repository->parsed_objects.nr_objs * 2)
-		grow_object_hash();
+		grow_object_hash(the_repository);
 
 	insert_obj_hash(obj, the_repository->parsed_objects.obj_hash,
 			the_repository->parsed_objects.obj_hash_size);
-- 
2.15.1.433.g936d1b9894.dirty