Skip to content

Commit 8ba0e5e

Browse files
stefanbellergitster
authored andcommitted
alloc: add repository argument to alloc_commit_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 cf7203b commit 8ba0e5e

File tree

5 files changed

+6
-5
lines changed

5 files changed

+6
-5
lines changed

alloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ unsigned int alloc_commit_index(void)
8888
return count++;
8989
}
9090

91-
void *alloc_commit_node(void)
91+
void *alloc_commit_node_the_repository(void)
9292
{
9393
struct commit *c = alloc_node(&commit_state, sizeof(struct commit));
9494
c->object.type = OBJ_COMMIT;

blame.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ static struct commit *fake_working_tree_commit(struct diff_options *opt,
161161

162162
read_cache();
163163
time(&now);
164-
commit = alloc_commit_node();
164+
commit = alloc_commit_node(the_repository);
165165
commit->object.parsed = 1;
166166
commit->date = now;
167167
parent_tail = &commit->parents;

cache.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1768,7 +1768,8 @@ void encode_85(char *buf, const unsigned char *data, int bytes);
17681768
extern void *alloc_blob_node_the_repository(void);
17691769
#define alloc_tree_node(r) alloc_tree_node_##r()
17701770
extern void *alloc_tree_node_the_repository(void);
1771-
extern void *alloc_commit_node(void);
1771+
#define alloc_commit_node(r) alloc_commit_node_##r()
1772+
extern void *alloc_commit_node_the_repository(void);
17721773
extern void *alloc_tag_node(void);
17731774
extern void *alloc_object_node(void);
17741775
extern void alloc_report(void);

commit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct commit *lookup_commit(const struct object_id *oid)
5151
struct object *obj = lookup_object(oid->hash);
5252
if (!obj)
5353
return create_object(the_repository, oid->hash,
54-
alloc_commit_node());
54+
alloc_commit_node(the_repository));
5555
return object_as_type(obj, OBJ_COMMIT, 0);
5656
}
5757

merge-recursive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static struct tree *shift_tree_object(struct tree *one, struct tree *two,
9898

9999
static struct commit *make_virtual_commit(struct tree *tree, const char *comment)
100100
{
101-
struct commit *commit = alloc_commit_node();
101+
struct commit *commit = alloc_commit_node(the_repository);
102102

103103
set_merge_remote_desc(commit, comment, (struct object *)commit);
104104
commit->tree = tree;

0 commit comments

Comments
 (0)