Daniel Barkalow | 6eb8ae0 | 2005-04-18 18:39:48 | [diff] [blame] | 1 | #ifndef OBJECT_H |
| 2 | #define OBJECT_H |
| 3 | |
| 4 | struct object_list { |
| 5 | struct object *item; |
| 6 | struct object_list *next; |
Linus Torvalds | 9ce43d1 | 2005-06-26 22:26:05 | [diff] [blame] | 7 | const char *name; |
Daniel Barkalow | 6eb8ae0 | 2005-04-18 18:39:48 | [diff] [blame] | 8 | }; |
| 9 | |
| 10 | struct object { |
| 11 | unsigned parsed : 1; |
| 12 | unsigned used : 1; |
| 13 | unsigned int flags; |
| 14 | unsigned char sha1[20]; |
| 15 | const char *type; |
| 16 | struct object_list *refs; |
jon@blackcubes.dyndns.org | a3437b8 | 2005-06-06 15:39:40 | [diff] [blame] | 17 | void *util; |
Daniel Barkalow | 6eb8ae0 | 2005-04-18 18:39:48 | [diff] [blame] | 18 | }; |
| 19 | |
Linus Torvalds | 8805cca | 2005-09-16 21:55:33 | [diff] [blame] | 20 | extern int track_object_refs; |
Petr Baudis | 8835504 | 2005-05-10 22:58:16 | [diff] [blame] | 21 | extern int nr_objs; |
| 22 | extern struct object **objs; |
Daniel Barkalow | 6eb8ae0 | 2005-04-18 18:39:48 | [diff] [blame] | 23 | |
Daniel Barkalow | 89e4202 | 2005-06-22 00:35:10 | [diff] [blame] | 24 | /** Internal only **/ |
Jason McMullan | 5d6ccf5 | 2005-06-03 15:05:39 | [diff] [blame] | 25 | struct object *lookup_object(const unsigned char *sha1); |
Daniel Barkalow | 6eb8ae0 | 2005-04-18 18:39:48 | [diff] [blame] | 26 | |
Daniel Barkalow | 89e4202 | 2005-06-22 00:35:10 | [diff] [blame] | 27 | /** Returns the object, having looked it up as being the given type. **/ |
| 28 | struct object *lookup_object_type(const unsigned char *sha1, const char *type); |
| 29 | |
Jason McMullan | 5d6ccf5 | 2005-06-03 15:05:39 | [diff] [blame] | 30 | void created_object(const unsigned char *sha1, struct object *obj); |
Daniel Barkalow | 6eb8ae0 | 2005-04-18 18:39:48 | [diff] [blame] | 31 | |
Daniel Barkalow | e9eefa6 | 2005-04-28 14:46:33 | [diff] [blame] | 32 | /** Returns the object, having parsed it to find out what it is. **/ |
Jason McMullan | 5d6ccf5 | 2005-06-03 15:05:39 | [diff] [blame] | 33 | struct object *parse_object(const unsigned char *sha1); |
Daniel Barkalow | e9eefa6 | 2005-04-28 14:46:33 | [diff] [blame] | 34 | |
barkalow@iabervon.org | 66e481b | 2005-08-02 23:45:48 | [diff] [blame] | 35 | /** Returns the object, with potentially excess memory allocated. **/ |
| 36 | struct object *lookup_unknown_object(const unsigned char *sha1); |
| 37 | |
Daniel Barkalow | 6eb8ae0 | 2005-04-18 18:39:48 | [diff] [blame] | 38 | void add_ref(struct object *refer, struct object *target); |
| 39 | |
| 40 | void mark_reachable(struct object *obj, unsigned int mask); |
| 41 | |
barkalow@iabervon.org | 66e481b | 2005-08-02 23:45:48 | [diff] [blame] | 42 | struct object_list *object_list_insert(struct object *item, |
| 43 | struct object_list **list_p); |
| 44 | |
Daniel Barkalow | 680bab3 | 2005-09-05 06:04:18 | [diff] [blame] | 45 | void object_list_append(struct object *item, |
| 46 | struct object_list **list_p); |
| 47 | |
barkalow@iabervon.org | 66e481b | 2005-08-02 23:45:48 | [diff] [blame] | 48 | unsigned object_list_length(struct object_list *list); |
| 49 | |
| 50 | int object_list_contains(struct object_list *list, struct object *obj); |
| 51 | |
Daniel Barkalow | 6eb8ae0 | 2005-04-18 18:39:48 | [diff] [blame] | 52 | #endif /* OBJECT_H */ |