]> git.ipfire.org Git - thirdparty/git.git/commitdiff
alloc: add repository argument to alloc_object_node
authorStefan Beller <sbeller@google.com>
Tue, 8 May 2018 19:37:31 +0000 (12:37 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 9 May 2018 03:12:36 +0000 (12:12 +0900)
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>
alloc.c
cache.h
object.c

diff --git a/alloc.c b/alloc.c
index 290250e3595c239ccf1a4912425aae7f500f6666..f031ce422d95d08818afd38590a3c46064fbadac 100644 (file)
--- a/alloc.c
+++ b/alloc.c
@@ -73,7 +73,7 @@ void *alloc_tag_node_the_repository(void)
 }
 
 static struct alloc_state object_state;
-void *alloc_object_node(void)
+void *alloc_object_node_the_repository(void)
 {
        struct object *obj = alloc_node(&object_state, sizeof(union any_object));
        obj->type = OBJ_NONE;
diff --git a/cache.h b/cache.h
index 32f340cde597287c9134c49aa891b049ff3a2773..2d60359a96412bf6bd94e1ac8eea44081d4c88ac 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -1772,7 +1772,8 @@ extern void *alloc_tree_node_the_repository(void);
 extern void *alloc_commit_node_the_repository(void);
 #define alloc_tag_node(r) alloc_tag_node_##r()
 extern void *alloc_tag_node_the_repository(void);
-extern void *alloc_object_node(void);
+#define alloc_object_node(r) alloc_object_node_##r()
+extern void *alloc_object_node_the_repository(void);
 extern void alloc_report(void);
 extern unsigned int alloc_commit_index(void);
 
index 91edc30770c60c9e64d9910460afc694027db717..b8c3f923c515cb24cb65947c0c24fead9b543e87 100644 (file)
--- a/object.c
+++ b/object.c
@@ -180,7 +180,7 @@ struct object *lookup_unknown_object(const unsigned char *sha1)
        struct object *obj = lookup_object(sha1);
        if (!obj)
                obj = create_object(the_repository, sha1,
-                                   alloc_object_node());
+                                   alloc_object_node(the_repository));
        return obj;
 }