fragment: add pkg_fragment_free().

feature/tap-sh
William Pitcock 2012-05-06 20:26:09 -05:00
parent ba1c41eb14
commit 81fd865a49
2 changed files with 10 additions and 0 deletions

View File

@ -111,3 +111,12 @@ pkg_fragment_delete(pkg_fragment_t *node)
free(node->data); free(node->data);
free(node); free(node);
} }
void
pkg_fragment_free(pkg_fragment_t *head)
{
pkg_fragment_t *node, *next;
foreach_list_entry_safe(head, next, node)
pkg_fragment_delete(node);
}

1
pkg.h
View File

@ -150,6 +150,7 @@ pkg_fragment_t *pkg_fragment_add(pkg_fragment_t *head, const char *string);
pkg_fragment_t *pkg_fragment_copy(pkg_fragment_t *head, pkg_fragment_t *base); pkg_fragment_t *pkg_fragment_copy(pkg_fragment_t *head, pkg_fragment_t *base);
void pkg_fragment_delete(pkg_fragment_t *node); void pkg_fragment_delete(pkg_fragment_t *node);
bool pkg_fragment_exists(pkg_fragment_t *head, pkg_fragment_t *base); bool pkg_fragment_exists(pkg_fragment_t *head, pkg_fragment_t *base);
void pkg_fragment_free(pkg_fragment_t *head);
/* fileio.c */ /* fileio.c */
char *pkg_fgetline(char *line, size_t size, FILE *stream); char *pkg_fgetline(char *line, size_t size, FILE *stream);