Skip to content

Commit

Permalink
[PATCH] Add function to append to an object_list.
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Daniel Barkalow authored and Junio C Hamano committed Sep 11, 2005
1 parent 77675e2 commit 680bab3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions object.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions object.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 680bab3

Please sign in to comment.