alloc: add repository argument to alloc_object_node

This is a small mechanical change; it doesn't change the implementation to handle repositories other than the_repository yet. Use a macro to catch callers passing a repository other than the_repository at compile time. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Stefan Beller committed May 8, 2018 at 12:37 UTC 13e3fdcb767fe860953f8c27eb1985bd5d15674d
3 files changed +4 -3
alloc.c
+1 -1
@@ -73,7 +73,7 @@ void *alloc_tag_node_the_repository(void)
73 }
74
75 static struct alloc_state object_state;
76 -void *alloc_object_node(void)
76 +void *alloc_object_node_the_repository(void)
77 {
78 struct object *obj = alloc_node(&object_state, sizeof(union any_object));
79 obj->type = OBJ_NONE;
cache.h
+2 -1
@@ -1772,7 +1772,8 @@ extern void *alloc_tree_node_the_repository(void);
1772 extern void *alloc_commit_node_the_repository(void);
1773 #define alloc_tag_node(r) alloc_tag_node_##r()
1774 extern void *alloc_tag_node_the_repository(void);
1775 -extern void *alloc_object_node(void);
1775 +#define alloc_object_node(r) alloc_object_node_##r()
1776 +extern void *alloc_object_node_the_repository(void);
1777 extern void alloc_report(void);
1778 extern unsigned int alloc_commit_index(void);
1779
object.c
+1 -1
@@ -180,7 +180,7 @@ struct object *lookup_unknown_object(const unsigned char *sha1)
180 struct object *obj = lookup_object(sha1);
181 if (!obj)
182 obj = create_object(the_repository, sha1,
183 - alloc_object_node());
183 + alloc_object_node(the_repository));
184 return obj;
185 }
186