Skip to content

Commit f0de1d6

Browse files
stefanbellergitster
authored andcommitted
alloc: add repository argument to alloc_blob_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 c077a45 commit f0de1d6

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
@@ -49,7 +49,7 @@ static inline void *alloc_node(struct alloc_state *s, size_t node_size)
4949
}
5050

5151
static struct alloc_state blob_state;
52-
void *alloc_blob_node(void)
52+
void *alloc_blob_node_the_repository(void)
5353
{
5454
struct blob *b = alloc_node(&blob_state, sizeof(struct blob));
5555
b->object.type = OBJ_BLOB;

blob.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ struct blob *lookup_blob(const struct object_id *oid)
99
struct object *obj = lookup_object(oid->hash);
1010
if (!obj)
1111
return create_object(the_repository, oid->hash,
12-
alloc_blob_node());
12+
alloc_blob_node(the_repository));
1313
return object_as_type(obj, OBJ_BLOB, 0);
1414
}
1515

cache.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1764,7 +1764,8 @@ int decode_85(char *dst, const char *line, int linelen);
17641764
void encode_85(char *buf, const unsigned char *data, int bytes);
17651765

17661766
/* alloc.c */
1767-
extern void *alloc_blob_node(void);
1767+
#define alloc_blob_node(r) alloc_blob_node_##r()
1768+
extern void *alloc_blob_node_the_repository(void);
17681769
extern void *alloc_tree_node(void);
17691770
extern void *alloc_commit_node(void);
17701771
extern void *alloc_tag_node(void);

0 commit comments

Comments
 (0)