aboutsummaryrefslogtreecommitdiff
path: root/src/pack.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pack.c')
-rw-r--r--src/pack.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/pack.c b/src/pack.c
index 9e9e0ed..6c21c89 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -714,6 +714,31 @@ packcomp(const char *s, char **endp)
return head;
}
+struct packinst *
+packdup(struct packinst *src)
+{
+ struct packinst *head = NULL, *tail = NULL, *p;
+
+ for (; src; src = src->next) {
+ p = malloc(sizeof(*p));
+ if (!p) {
+ packfree(head);
+ errno = ENOMEM;
+ return NULL;
+ }
+ p->next = NULL;
+ p->spec = src->spec;
+ p->rep = src->rep;
+ p->cur = src->cur;
+ if (tail)
+ tail->next = p;
+ else
+ head = p;
+ tail = p;
+ }
+ return head;
+}
+
void
packfree(struct packinst *pi)
{

Return to:

Send suggestions and report system problems to the System administrator.