Skip to content

Commit dd5d9de

Browse files
stefanbellergitster
authored andcommitted
alloc: add repository argument to alloc_commit_index
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 17bfe87 commit dd5d9de

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

alloc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ void *alloc_object_node_the_repository(void)
8282

8383
static struct alloc_state commit_state;
8484

85-
unsigned int alloc_commit_index(void)
85+
unsigned int alloc_commit_index_the_repository(void)
8686
{
8787
static unsigned int count;
8888
return count++;
@@ -92,7 +92,7 @@ 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;
95-
c->index = alloc_commit_index();
95+
c->index = alloc_commit_index(the_repository);
9696
return c;
9797
}
9898

cache.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1776,7 +1776,8 @@ extern void *alloc_tag_node_the_repository(void);
17761776
extern void *alloc_object_node_the_repository(void);
17771777
#define alloc_report(r) alloc_report_##r()
17781778
extern void alloc_report_the_repository(void);
1779-
extern unsigned int alloc_commit_index(void);
1779+
#define alloc_commit_index(r) alloc_commit_index_##r()
1780+
extern unsigned int alloc_commit_index_the_repository(void);
17801781

17811782
/* pkt-line.c */
17821783
void packet_trace_identity(const char *prog);

object.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ void *object_as_type(struct object *obj, enum object_type type, int quiet)
162162
return obj;
163163
else if (obj->type == OBJ_NONE) {
164164
if (type == OBJ_COMMIT)
165-
((struct commit *)obj)->index = alloc_commit_index();
165+
((struct commit *)obj)->index = alloc_commit_index(the_repository);
166166
obj->type = type;
167167
return obj;
168168
}

0 commit comments

Comments
 (0)