git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/4] Add function to append to an object_list.

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Sep 5, 2005, 06:04 UTC
Message-ID
<Pine.LNX.4.63.0509050203540.23242@iabervon.org>
In-Reply-To
<Pine.LNX.4.63.0509050151240.23242@iabervon.org>
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
---
 object.c |   11 +++++++++++
 object.h |    3 +++
 2 files changed, 14 insertions(+), 0 deletions(-)
88cf2db55848e7a2cf655171c7e9fd74c70a0281
diff --git a/object.c b/object.c
--- a/object.c
+++ b/object.c
@@ -184,6 +184,17 @@ struct object_list *object_list_insert(s
         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
--- a/object.h
+++ b/object.h
@@ -41,6 +41,9 @@ void mark_reachable(struct object *obj, 
 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);
Previous: Daniel BarkalowNext: Daniel Barkalow
Message 3 of 5 in “Support multiple ancestors in read-tree”
  1. 0/4 Support multiple ancestors in read-treeDaniel Barkalow, Sep 5, 2005
  2. 1/4 Add a function for getting a struct tree for an ent.Daniel Barkalow, Sep 5, 2005
  3. 2/4 Add function to append to an object_list.Daniel Barkalow, Sep 5, 2005
  4. 3/4 Rewrite read-treeDaniel Barkalow, Sep 5, 2005
  5. 4/4 Document the trivial merge rules for 3(+more ancestors)-way merges.Daniel Barkalow, Sep 5, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.