parse: add pkg_dependency_free().

pull/15/head
William Pitcock 2012-05-06 20:26:24 -05:00
parent 81fd865a49
commit 9b540397f0
2 changed files with 18 additions and 0 deletions

17
parse.c
View File

@ -107,6 +107,23 @@ pkg_dependency_append(pkg_dependency_t *head, pkg_dependency_t *tail)
return head;
}
void
pkg_dependency_free(pkg_dependency_t *head)
{
pkg_dependency_t *node, *next;
foreach_list_entry_safe(head, next, node)
{
if (node->package != NULL)
free(node->package);
if (node->version != NULL)
free(node->version);
free(node);
}
}
pkg_dependency_t *
parse_deplist(pkg_t *pkg, const char *depends)
{

1
pkg.h
View File

@ -140,6 +140,7 @@ const char *pkg_get_comparator(pkg_dependency_t *pkgdep);
pkg_t *parse_file(const char *path, FILE *f);
pkg_dependency_t *parse_deplist(pkg_t *pkg, const char *depends);
pkg_dependency_t *pkg_dependency_append(pkg_dependency_t *head, pkg_dependency_t *tail);
void pkg_dependency_free(pkg_dependency_t *head);
/* argvsplit.c */
int argv_split(const char *src, int *argc, char ***argv);