alloc: add repository argument to alloc_tag_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 a0bd9086bb66fa8cb84bd4fac6441699121e1327
3 files changed +4 -3
alloc.c
+1 -1
@@ -65,7 +65,7 @@ void *alloc_tree_node_the_repository(void)
65 }
66
67 static struct alloc_state tag_state;
68 -void *alloc_tag_node(void)
68 +void *alloc_tag_node_the_repository(void)
69 {
70 struct tag *t = alloc_node(&tag_state, sizeof(struct tag));
71 t->object.type = OBJ_TAG;
cache.h
+2 -1
@@ -1770,7 +1770,8 @@ extern void *alloc_blob_node_the_repository(void);
1770 extern void *alloc_tree_node_the_repository(void);
1771 #define alloc_commit_node(r) alloc_commit_node_##r()
1772 extern void *alloc_commit_node_the_repository(void);
1773 -extern void *alloc_tag_node(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);
1776 extern void alloc_report(void);
1777 extern unsigned int alloc_commit_index(void);
tag.c
+1 -1
@@ -94,7 +94,7 @@ struct tag *lookup_tag(const struct object_id *oid)
94 struct object *obj = lookup_object(oid->hash);
95 if (!obj)
96 return create_object(the_repository, oid->hash,
97 - alloc_tag_node());
97 + alloc_tag_node(the_repository));
98 return object_as_type(obj, OBJ_TAG, 0);
99 }
100