[PATCH] Add function to append to an object_list.
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Daniel Barkalow committed
Sep 5, 2005 at 02:04 UTC
680bab3d9a33029be38590681832ae9b6d74ad60
2 files changed
+14
object.c
+11
@@ -184,6 +184,17 @@ struct object_list *object_list_insert(struct object *item,
184
return new_list;
185
}
186
187
+void object_list_append(struct object *item,
188
+ struct object_list **list_p)
189
+{
190
+ while (*list_p) {
191
+ list_p = &((*list_p)->next);
192
+ }
193
+ *list_p = xmalloc(sizeof(struct object_list));
194
+ (*list_p)->next = NULL;
195
+ (*list_p)->item = item;
196
+}
197
+
198
unsigned object_list_length(struct object_list *list)
199
{
200
unsigned ret = 0;
object.h
+3
@@ -41,6 +41,9 @@ void mark_reachable(struct object *obj, unsigned int mask);
41
struct object_list *object_list_insert(struct object *item,
42
struct object_list **list_p);
43
44
+void object_list_append(struct object *item,
45
+ struct object_list **list_p);
46
+
47
unsigned object_list_length(struct object_list *list);
48
49
int object_list_contains(struct object_list *list, struct object *obj);