summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--object.c11
-rw-r--r--object.h3
2 files changed, 14 insertions, 0 deletions
diff --git a/object.c b/object.c
index 72f6aa552f..63e6e784d4 100644
--- a/object.c
+++ b/object.c
@@ -184,6 +184,17 @@ struct object_list *object_list_insert(struct object *item,
return new_list;
}
+void object_list_append(struct object *item,
+ struct object_list **list_p)
+{
+ while (*list_p) {
+ list_p = &((*list_p)->next);
+ }
+ *list_p = xmalloc(sizeof(struct object_list));
+ (*list_p)->next = NULL;
+ (*list_p)->item = item;
+}
+
unsigned object_list_length(struct object_list *list)
{
unsigned ret = 0;
diff --git a/object.h b/object.h
index 5af530da5d..bf744490a9 100644
--- a/object.h
+++ b/object.h
@@ -41,6 +41,9 @@ void mark_reachable(struct object *obj, unsigned int mask);
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);