Merge in xdiff cleanup pieces
[git/mingw/4msysgit/kblees.git] / object.h
blobe08afbd29ff04cf463a4aacdc4fe141a2ab54ce6
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_refs {
11 unsigned count;
12 struct object *ref[FLEX_ARRAY]; /* more */
15 struct object {
16 unsigned parsed : 1;
17 unsigned used : 1;
18 unsigned int flags;
19 unsigned char sha1[20];
20 const char *type;
21 struct object_refs *refs;
22 void *util;
25 extern int track_object_refs;
26 extern int obj_allocs;
27 extern struct object **objs;
29 /** Internal only **/
30 struct object *lookup_object(const unsigned char *sha1);
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);
35 void created_object(const unsigned char *sha1, struct object *obj);
37 /** Returns the object, having parsed it to find out what it is. **/
38 struct object *parse_object(const unsigned char *sha1);
40 /** Returns the object, with potentially excess memory allocated. **/
41 struct object *lookup_unknown_object(const unsigned char *sha1);
43 struct object_refs *alloc_object_refs(unsigned count);
44 void set_object_refs(struct object *obj, struct object_refs *refs);
46 void mark_reachable(struct object *obj, unsigned int mask);
48 struct object_list *object_list_insert(struct object *item,
49 struct object_list **list_p);
51 void object_list_append(struct object *item,
52 struct object_list **list_p);
54 unsigned object_list_length(struct object_list *list);
56 int object_list_contains(struct object_list *list, struct object *obj);
58 #endif /* OBJECT_H */