Prepare 0.99.7 release candidate branch.
[git/jnareb-git/bp-gitweb.git] / object.h
blobbf744490a9a75c5e84af6384b2fa2bc4eb492452
1 #ifndef OBJECT_H
2 #define OBJECT_H
4 struct object_list {
5 struct object *item;
6 struct object_list *next;
7 const char *name;
8 };
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;
17 void *util;
20 extern int nr_objs;
21 extern struct object **objs;
23 /** Internal only **/
24 struct object *lookup_object(const unsigned char *sha1);
26 /** Returns the object, having looked it up as being the given type. **/
27 struct object *lookup_object_type(const unsigned char *sha1, const char *type);
29 void created_object(const unsigned char *sha1, struct object *obj);
31 /** Returns the object, having parsed it to find out what it is. **/
32 struct object *parse_object(const unsigned char *sha1);
34 /** Returns the object, with potentially excess memory allocated. **/
35 struct object *lookup_unknown_object(const unsigned char *sha1);
37 void add_ref(struct object *refer, struct object *target);
39 void mark_reachable(struct object *obj, unsigned int mask);
41 struct object_list *object_list_insert(struct object *item,
42 struct object_list **list_p);
44 void object_list_append(struct object *item,
45 struct object_list **list_p);
47 unsigned object_list_length(struct object_list *list);
49 int object_list_contains(struct object_list *list, struct object *obj);
51 #endif /* OBJECT_H */