提交 680bab3d 编写于 作者: D Daniel Barkalow 提交者: Junio C Hamano

[PATCH] Add function to append to an object_list.

Signed-off-by: NDaniel Barkalow <barkalow@iabervon.org>
Signed-off-by: NJunio C Hamano <junkio@cox.net>
上级 77675e2a
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册