fragment: add pkg_fragment_copy().
parent
c1e5ab046b
commit
d94ab7555d
13
fragment.c
13
fragment.c
|
@ -66,6 +66,19 @@ pkg_fragment_add(pkg_fragment_t *head, const char *string)
|
|||
return pkg_fragment_append(head, frag);
|
||||
}
|
||||
|
||||
pkg_fragment_t *
|
||||
pkg_fragment_copy(pkg_fragment_t *head, pkg_fragment_t *base)
|
||||
{
|
||||
pkg_fragment_t *frag;
|
||||
|
||||
frag = calloc(sizeof(pkg_fragment_t), 1);
|
||||
|
||||
frag->type = base->type;
|
||||
frag->data = strdup(base->data);
|
||||
|
||||
return pkg_fragment_append(head, frag);
|
||||
}
|
||||
|
||||
void
|
||||
pkg_fragment_delete(pkg_fragment_t *node)
|
||||
{
|
||||
|
|
1
pkg.h
1
pkg.h
|
@ -136,6 +136,7 @@ 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);
|
||||
pkg_fragment_t *pkg_fragment_copy(pkg_fragment_t *head, pkg_fragment_t *base);
|
||||
void pkg_fragment_delete(pkg_fragment_t *node);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue