]>
Commit | Line | Data |
---|---|---|
6eb8ae00 DB |
1 | #ifndef OBJECT_H |
2 | #define OBJECT_H | |
3 | ||
4 | struct object_list { | |
5 | struct object *item; | |
6 | struct object_list *next; | |
9ce43d1c | 7 | const char *name; |
6eb8ae00 DB |
8 | }; |
9 | ||
27dedf0c JH |
10 | struct object_refs { |
11 | unsigned count; | |
8f1d2e6f | 12 | struct object *ref[FLEX_ARRAY]; /* more */ |
27dedf0c JH |
13 | }; |
14 | ||
6eb8ae00 DB |
15 | struct object { |
16 | unsigned parsed : 1; | |
17 | unsigned used : 1; | |
18 | unsigned int flags; | |
19 | unsigned char sha1[20]; | |
20 | const char *type; | |
27dedf0c | 21 | struct object_refs *refs; |
a3437b8c | 22 | void *util; |
6eb8ae00 DB |
23 | }; |
24 | ||
8805ccac | 25 | extern int track_object_refs; |
070879ca | 26 | extern int obj_allocs; |
88355048 | 27 | extern struct object **objs; |
6eb8ae00 | 28 | |
89e4202f | 29 | /** Internal only **/ |
5d6ccf5c | 30 | struct object *lookup_object(const unsigned char *sha1); |
6eb8ae00 | 31 | |
89e4202f DB |
32 | /** Returns the object, having looked it up as being the given type. **/ |
33 | struct object *lookup_object_type(const unsigned char *sha1, const char *type); | |
34 | ||
5d6ccf5c | 35 | void created_object(const unsigned char *sha1, struct object *obj); |
6eb8ae00 | 36 | |
e9eefa67 | 37 | /** Returns the object, having parsed it to find out what it is. **/ |
5d6ccf5c | 38 | struct object *parse_object(const unsigned char *sha1); |
e9eefa67 | 39 | |
66e481b0 DB |
40 | /** Returns the object, with potentially excess memory allocated. **/ |
41 | struct object *lookup_unknown_object(const unsigned char *sha1); | |
42 | ||
27dedf0c JH |
43 | struct object_refs *alloc_object_refs(unsigned count); |
44 | void set_object_refs(struct object *obj, struct object_refs *refs); | |
6eb8ae00 DB |
45 | |
46 | void mark_reachable(struct object *obj, unsigned int mask); | |
47 | ||
66e481b0 DB |
48 | struct object_list *object_list_insert(struct object *item, |
49 | struct object_list **list_p); | |
50 | ||
680bab3d DB |
51 | void object_list_append(struct object *item, |
52 | struct object_list **list_p); | |
53 | ||
66e481b0 DB |
54 | unsigned object_list_length(struct object_list *list); |
55 | ||
56 | int object_list_contains(struct object_list *list, struct object *obj); | |
57 | ||
6eb8ae00 | 58 | #endif /* OBJECT_H */ |