X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=object.h;h=b6618d92bf04d549350d83b6237770c48734686f;hb=50c94032844bb184cdeff7779be3b6a23e04d312;hp=036bd66fe9b6591e959e6df51160e636ab1a682e;hpb=4d9e42f8f11c57b32b976a943c8ddaf6214e64b8;p=git.git diff --git a/object.h b/object.h index 036bd66fe..b6618d92b 100644 --- a/object.h +++ b/object.h @@ -6,11 +6,6 @@ struct object_list { struct object_list *next; }; -struct object_refs { - unsigned count; - struct object *ref[FLEX_ARRAY]; /* more */ -}; - struct object_array { unsigned int nr; unsigned int alloc; @@ -21,6 +16,8 @@ struct object_array { } *objects; }; +#define OBJECT_ARRAY_INIT { 0, 0, NULL } + #define TYPE_BITS 3 #define FLAG_BITS 27 @@ -41,7 +38,18 @@ extern int type_from_string(const char *str); extern unsigned int get_max_object_index(void); extern struct object *get_indexed_object(unsigned int); -/** Internal only **/ +/* + * This can be used to see if we have heard of the object before, but + * it can return "yes we have, and here is a half-initialised object" + * for an object that we haven't loaded/parsed yet. + * + * When parsing a commit to create an in-core commit object, its + * parents list holds commit objects that represent its parents, but + * they are expected to be lazily initialized and do not know what + * their trees or parents are yet. When this function returns such a + * half-initialised objects, the caller is expected to initialize them + * by calling parse_object() on them. + */ struct object *lookup_object(const unsigned char *sha1); extern void *create_object(const unsigned char *sha1, int type, void *obj); @@ -61,15 +69,11 @@ struct object *lookup_unknown_object(const unsigned char *sha1); struct object_list *object_list_insert(struct object *item, struct object_list **list_p); -void object_list_append(struct object *item, - struct object_list **list_p); - -unsigned object_list_length(struct object_list *list); - int object_list_contains(struct object_list *list, struct object *obj); /* Object array handling .. */ void add_object_array(struct object *obj, const char *name, struct object_array *array); void add_object_array_with_mode(struct object *obj, const char *name, struct object_array *array, unsigned mode); +void object_array_remove_duplicates(struct object_array *); #endif /* OBJECT_H */