fix #96: stringpair_list_dup now iterative.
1.1 --- a/src/stringpair.c Mon Jul 11 11:41:36 2016 +0200
1.2 +++ b/src/stringpair.c Mon Jul 11 11:43:03 2016 +0200
1.3 @@ -58,6 +58,8 @@
1.4 if (result && value)
1.5 result->value = value;
1.6
1.7 + result->next = NULL;
1.8 +
1.9 return result;
1.10 }
1.11
1.12 @@ -73,15 +75,17 @@
1.13 if (dst == NULL)
1.14 return NULL;
1.15
1.16 - if (src->next) {
1.17 - dst->next = stringpair_list_dup(src->next);
1.18 - if (dst->next == NULL) {
1.19 - free_stringpair_list(dst);
1.20 - return NULL;
1.21 - }
1.22 + stringpair_list_t* src_curr = src->next;
1.23 + stringpair_list_t** dst_curr_ptr = &dst->next;
1.24 +
1.25 + while (src_curr) {
1.26 + *dst_curr_ptr = new_stringpair_list(src_curr->value);
1.27 + src_curr = src_curr->next;
1.28 + dst_curr_ptr = &((*dst_curr_ptr)->next);
1.29 }
1.30
1.31 return dst;
1.32 +
1.33 }
1.34
1.35 DYNAMIC_API stringpair_list_t *stringpair_list_add(