blame: prefer xsnprintf to strcpy for colors
[gitweb.git] / object.c
index f818777412187890b88a6c90507b8b41f131487c..b9a4a0e50172fb169226786b17134c6ab0627333 100644 (file)
--- a/object.c
+++ b/object.c
@@ -141,7 +141,6 @@ void *create_object(const unsigned char *sha1, void *o)
        struct object *obj = o;
 
        obj->parsed = 0;
-       obj->used = 0;
        obj->flags = 0;
        hashcpy(obj->oid.hash, sha1);
 
@@ -354,6 +353,19 @@ static void object_array_release_entry(struct object_array_entry *ent)
        free(ent->path);
 }
 
+struct object *object_array_pop(struct object_array *array)
+{
+       struct object *ret;
+
+       if (!array->nr)
+               return NULL;
+
+       ret = array->objects[array->nr - 1].item;
+       object_array_release_entry(&array->objects[array->nr - 1]);
+       array->nr--;
+       return ret;
+}
+
 void object_array_filter(struct object_array *array,
                         object_array_each_func_t want, void *cb_data)
 {