Skip to content

Commit cf7203b

Browse files
stefanbellergitster
authored andcommitted
alloc: add repository argument to alloc_tree_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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f0de1d6 commit cf7203b

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

alloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void *alloc_blob_node_the_repository(void)
5757
}
5858

5959
static struct alloc_state tree_state;
60-
void *alloc_tree_node(void)
60+
void *alloc_tree_node_the_repository(void)
6161
{
6262
struct tree *t = alloc_node(&tree_state, sizeof(struct tree));
6363
t->object.type = OBJ_TREE;

cache.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1766,7 +1766,8 @@ void encode_85(char *buf, const unsigned char *data, int bytes);
17661766
/* alloc.c */
17671767
#define alloc_blob_node(r) alloc_blob_node_##r()
17681768
extern void *alloc_blob_node_the_repository(void);
1769-
extern void *alloc_tree_node(void);
1769+
#define alloc_tree_node(r) alloc_tree_node_##r()
1770+
extern void *alloc_tree_node_the_repository(void);
17701771
extern void *alloc_commit_node(void);
17711772
extern void *alloc_tag_node(void);
17721773
extern void *alloc_object_node(void);

tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ struct tree *lookup_tree(const struct object_id *oid)
197197
struct object *obj = lookup_object(oid->hash);
198198
if (!obj)
199199
return create_object(the_repository, oid->hash,
200-
alloc_tree_node());
200+
alloc_tree_node(the_repository));
201201
return object_as_type(obj, OBJ_TREE, 0);
202202
}
203203

0 commit comments

Comments
 (0)