diff --git a/fragment.c b/fragment.c index 481b48f..f891387 100644 --- a/fragment.c +++ b/fragment.c @@ -111,3 +111,12 @@ pkg_fragment_delete(pkg_fragment_t *node) free(node->data); 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); +} diff --git a/pkg.h b/pkg.h index b42dc70..555b6f1 100644 --- a/pkg.h +++ b/pkg.h @@ -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); void pkg_fragment_delete(pkg_fragment_t *node); bool pkg_fragment_exists(pkg_fragment_t *head, pkg_fragment_t *base); +void pkg_fragment_free(pkg_fragment_t *head); /* fileio.c */ char *pkg_fgetline(char *line, size_t size, FILE *stream);