object.hon commit Merge branch 'master' into next (d55e0ff)
   1#ifndef OBJECT_H
   2#define OBJECT_H
   3
   4struct object_list {
   5        struct object *item;
   6        struct object_list *next;
   7        const char *name;
   8};
   9
  10struct object_refs {
  11        unsigned count;
  12        struct object *ref[FLEX_ARRAY]; /* more */
  13};
  14
  15struct 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;
  23};
  24
  25extern int track_object_refs;
  26extern int obj_allocs;
  27extern struct object **objs;
  28
  29/** Internal only **/
  30struct object *lookup_object(const unsigned char *sha1);
  31
  32/** Returns the object, having looked it up as being the given type. **/
  33struct object *lookup_object_type(const unsigned char *sha1, const char *type);
  34
  35void created_object(const unsigned char *sha1, struct object *obj);
  36
  37/** Returns the object, having parsed it to find out what it is. **/
  38struct object *parse_object(const unsigned char *sha1);
  39
  40/** Returns the object, with potentially excess memory allocated. **/
  41struct object *lookup_unknown_object(const unsigned  char *sha1);
  42
  43struct object_refs *alloc_object_refs(unsigned count);
  44void set_object_refs(struct object *obj, struct object_refs *refs);
  45
  46void mark_reachable(struct object *obj, unsigned int mask);
  47
  48struct object_list *object_list_insert(struct object *item, 
  49                                       struct object_list **list_p);
  50
  51void object_list_append(struct object *item,
  52                        struct object_list **list_p);
  53
  54unsigned object_list_length(struct object_list *list);
  55
  56int object_list_contains(struct object_list *list, struct object *obj);
  57
  58#endif /* OBJECT_H */