# HG changeset patch # User Krista Grothoff # Date 1468230183 -7200 # Node ID 1d2fc388c49181ca2b286e5a4e53e8d1d6d7b477 # Parent 4d75512723442d848f81bd70ddf7fad9805516ba fix #96: stringpair_list_dup now iterative. diff -r 4d7551272344 -r 1d2fc388c491 src/stringpair.c --- a/src/stringpair.c Mon Jul 11 11:41:36 2016 +0200 +++ b/src/stringpair.c Mon Jul 11 11:43:03 2016 +0200 @@ -58,6 +58,8 @@ if (result && value) result->value = value; + result->next = NULL; + return result; } @@ -73,15 +75,17 @@ if (dst == NULL) return NULL; - if (src->next) { - dst->next = stringpair_list_dup(src->next); - if (dst->next == NULL) { - free_stringpair_list(dst); - return NULL; - } + stringpair_list_t* src_curr = src->next; + stringpair_list_t** dst_curr_ptr = &dst->next; + + while (src_curr) { + *dst_curr_ptr = new_stringpair_list(src_curr->value); + src_curr = src_curr->next; + dst_curr_ptr = &((*dst_curr_ptr)->next); } return dst; + } DYNAMIC_API stringpair_list_t *stringpair_list_add(