blob: 6accda33d8c8d6b8ef33a4df50bf350d9f088dc6 [file] [log] [blame]
Daniel Barkalow6eb8ae02005-04-18 18:39:481#ifndef OBJECT_H
2#define OBJECT_H
3
4struct object_list {
5 struct object *item;
6 struct object_list *next;
Linus Torvalds9ce43d12005-06-26 22:26:057 const char *name;
Daniel Barkalow6eb8ae02005-04-18 18:39:488};
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;
jon@blackcubes.dyndns.orga3437b82005-06-06 15:39:4017 void *util;
Daniel Barkalow6eb8ae02005-04-18 18:39:4818};
19
Linus Torvalds8805cca2005-09-16 21:55:3320extern int track_object_refs;
Petr Baudis88355042005-05-10 22:58:1621extern int nr_objs;
22extern struct object **objs;
Daniel Barkalow6eb8ae02005-04-18 18:39:4823
Daniel Barkalow89e42022005-06-22 00:35:1024/** Internal only **/
Jason McMullan5d6ccf52005-06-03 15:05:3925struct object *lookup_object(const unsigned char *sha1);
Daniel Barkalow6eb8ae02005-04-18 18:39:4826
Daniel Barkalow89e42022005-06-22 00:35:1027/** Returns the object, having looked it up as being the given type. **/
28struct object *lookup_object_type(const unsigned char *sha1, const char *type);
29
Jason McMullan5d6ccf52005-06-03 15:05:3930void created_object(const unsigned char *sha1, struct object *obj);
Daniel Barkalow6eb8ae02005-04-18 18:39:4831
Daniel Barkalowe9eefa62005-04-28 14:46:3332/** Returns the object, having parsed it to find out what it is. **/
Jason McMullan5d6ccf52005-06-03 15:05:3933struct object *parse_object(const unsigned char *sha1);
Daniel Barkalowe9eefa62005-04-28 14:46:3334
barkalow@iabervon.org66e481b2005-08-02 23:45:4835/** Returns the object, with potentially excess memory allocated. **/
36struct object *lookup_unknown_object(const unsigned char *sha1);
37
Daniel Barkalow6eb8ae02005-04-18 18:39:4838void add_ref(struct object *refer, struct object *target);
39
40void mark_reachable(struct object *obj, unsigned int mask);
41
barkalow@iabervon.org66e481b2005-08-02 23:45:4842struct object_list *object_list_insert(struct object *item,
43 struct object_list **list_p);
44
Daniel Barkalow680bab32005-09-05 06:04:1845void object_list_append(struct object *item,
46 struct object_list **list_p);
47
barkalow@iabervon.org66e481b2005-08-02 23:45:4848unsigned object_list_length(struct object_list *list);
49
50int object_list_contains(struct object_list *list, struct object *obj);
51
Daniel Barkalow6eb8ae02005-04-18 18:39:4852#endif /* OBJECT_H */