fragment: add pkg_fragment_delete().

pull/15/head
William Pitcock 2012-05-03 20:27:19 +00:00
parent de5e1c6e23
commit c1e5ab046b
2 changed files with 14 additions and 0 deletions

View File

@ -65,3 +65,16 @@ pkg_fragment_add(pkg_fragment_t *head, const char *string)
return pkg_fragment_append(head, frag);
}
void
pkg_fragment_delete(pkg_fragment_t *node)
{
if (node->prev != NULL)
node->prev->next = node->next;
if (node->next != NULL)
node->next->prev = node->prev;
free(node->data);
free(node);
}

1
pkg.h
View File

@ -136,5 +136,6 @@ int argv_split(const char *src, int *argc, char ***argv);
/* fragment.c */
pkg_fragment_t *pkg_fragment_append(pkg_fragment_t *head, pkg_fragment_t *tail);
pkg_fragment_t *pkg_fragment_add(pkg_fragment_t *head, const char *string);
void pkg_fragment_delete(pkg_fragment_t *node);
#endif