]> git.ipfire.org Git - thirdparty/git.git/blame - object.h
[PATCH] Improve git-rev-list memory usage further
[thirdparty/git.git] / object.h
CommitLineData
6eb8ae00
DB
1#ifndef OBJECT_H
2#define OBJECT_H
3
4struct object_list {
5 struct object *item;
6 struct object_list *next;
9ce43d1c 7 const char *name;
6eb8ae00
DB
8};
9
10struct 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;
a3437b8c 17 void *util;
6eb8ae00
DB
18};
19
88355048
PB
20extern int nr_objs;
21extern struct object **objs;
6eb8ae00 22
89e4202f 23/** Internal only **/
5d6ccf5c 24struct object *lookup_object(const unsigned char *sha1);
6eb8ae00 25
89e4202f
DB
26/** Returns the object, having looked it up as being the given type. **/
27struct object *lookup_object_type(const unsigned char *sha1, const char *type);
28
5d6ccf5c 29void created_object(const unsigned char *sha1, struct object *obj);
6eb8ae00 30
e9eefa67 31/** Returns the object, having parsed it to find out what it is. **/
5d6ccf5c 32struct object *parse_object(const unsigned char *sha1);
e9eefa67 33
66e481b0
DB
34/** Returns the object, with potentially excess memory allocated. **/
35struct object *lookup_unknown_object(const unsigned char *sha1);
36
6eb8ae00
DB
37void add_ref(struct object *refer, struct object *target);
38
39void mark_reachable(struct object *obj, unsigned int mask);
40
66e481b0
DB
41struct object_list *object_list_insert(struct object *item,
42 struct object_list **list_p);
43
680bab3d
DB
44void object_list_append(struct object *item,
45 struct object_list **list_p);
46
66e481b0
DB
47unsigned object_list_length(struct object_list *list);
48
49int object_list_contains(struct object_list *list, struct object *obj);
50
6eb8ae00 51#endif /* OBJECT_H */