src/pEpEngine.c
changeset 39 66b5cc6cb987
parent 37 7928e0e6eee9
child 46 7471e31bb278
     1.1 --- a/src/pEpEngine.c	Mon Dec 29 20:48:30 2014 +0100
     1.2 +++ b/src/pEpEngine.c	Tue Dec 30 13:04:17 2014 +0100
     1.3 @@ -269,6 +269,27 @@
     1.4      return result;
     1.5  }
     1.6  
     1.7 +DYNAMIC_API stringlist_t *stringlist_dup(const stringlist_t *src)
     1.8 +{
     1.9 +    assert(src);
    1.10 +    if (src == NULL)
    1.11 +        return NULL;
    1.12 +
    1.13 +    stringlist_t *dst = new_stringlist(src->value);
    1.14 +    if (dst == NULL)
    1.15 +        return NULL;
    1.16 +
    1.17 +    if (src->next) {
    1.18 +        dst->next = stringlist_dup(src->next);
    1.19 +        if (dst->next == NULL) {
    1.20 +            free(dst);
    1.21 +            return NULL;
    1.22 +        }
    1.23 +    }
    1.24 +
    1.25 +    return dst;
    1.26 +}
    1.27 +
    1.28  stringlist_t *stringlist_add(stringlist_t *stringlist, const char *value)
    1.29  {
    1.30      assert(value);
    1.31 @@ -294,6 +315,24 @@
    1.32      return stringlist->next;
    1.33  }
    1.34  
    1.35 +DYNAMIC_API stringlist_t *stringlist_append(stringlist_t *stringlist,
    1.36 +        stringlist_t *second)
    1.37 +{
    1.38 +    assert(stringlist);
    1.39 +
    1.40 +    if (second == NULL || second->value == NULL)
    1.41 +        return stringlist;
    1.42 +
    1.43 +    stringlist_t *_s = stringlist;
    1.44 +    stringlist_t *_s2;
    1.45 +    for (_s2 = second; _s2 != NULL; _s2 = _s2->next) {
    1.46 +        _s = stringlist_add(_s, _s2->value);
    1.47 +        if (_s == NULL)
    1.48 +            return NULL;
    1.49 +    }
    1.50 +    return _s;
    1.51 +}
    1.52 +
    1.53  int stringlist_length(const stringlist_t *stringlist)
    1.54  {
    1.55      int len = 1;