libpkgconf: tuple: add pkgconf_tuple_free_entry() to free a specific tuple node
parent
02ec215ecc
commit
f7b7853932
|
@ -242,6 +242,7 @@ pkgconf_tuple_t *pkgconf_tuple_add(const pkgconf_client_t *client, pkgconf_list_
|
|||
char *pkgconf_tuple_find(const pkgconf_client_t *client, pkgconf_list_t *list, const char *key);
|
||||
char *pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *list, const char *value);
|
||||
void pkgconf_tuple_free(pkgconf_list_t *list);
|
||||
void pkgconf_tuple_free_entry(pkgconf_tuple_t *tuple, pkgconf_list_t *list);
|
||||
void pkgconf_tuple_add_global(pkgconf_client_t *client, const char *key, const char *value);
|
||||
char *pkgconf_tuple_find_global(const pkgconf_client_t *client, const char *key);
|
||||
void pkgconf_tuple_free_global(pkgconf_client_t *client);
|
||||
|
|
|
@ -155,17 +155,21 @@ pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const
|
|||
return strdup(buf);
|
||||
}
|
||||
|
||||
void
|
||||
pkgconf_tuple_free_entry(pkgconf_tuple_t *tuple, pkgconf_list_t *list)
|
||||
{
|
||||
pkgconf_node_delete(&tuple->iter, list);
|
||||
|
||||
free(tuple->key);
|
||||
free(tuple->value);
|
||||
free(tuple);
|
||||
}
|
||||
|
||||
void
|
||||
pkgconf_tuple_free(pkgconf_list_t *list)
|
||||
{
|
||||
pkgconf_node_t *node, *next;
|
||||
|
||||
PKGCONF_FOREACH_LIST_ENTRY_SAFE(list->head, next, node)
|
||||
{
|
||||
pkgconf_tuple_t *tuple = node->data;
|
||||
|
||||
free(tuple->key);
|
||||
free(tuple->value);
|
||||
free(tuple);
|
||||
}
|
||||
pkgconf_tuple_free_entry(node->data, list);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue