fragment: add pkg_fragment_delete().
parent
de5e1c6e23
commit
c1e5ab046b
13
fragment.c
13
fragment.c
|
@ -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
1
pkg.h
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue