1.1 --- a/ucx/dlist.c Sat Dec 31 22:48:28 2011 +0100 1.2 +++ b/ucx/dlist.c Wed Jan 04 14:51:54 2012 +0100 1.3 @@ -1,5 +1,34 @@ 1.4 #include "dlist.h" 1.5 1.6 +UcxDlist *ucx_dlist_clone(UcxDlist *l, copy_func fnc, void *data) { 1.7 + UcxDlist *ret = NULL; 1.8 + while (l != NULL) { 1.9 + if (fnc != NULL) { 1.10 + ret = ucx_dlist_append(ret, fnc(l->data, data)); 1.11 + } else { 1.12 + ret = ucx_dlist_append(ret, l->data); 1.13 + } 1.14 + l = l->next; 1.15 + } 1.16 + return ret; 1.17 +} 1.18 + 1.19 +int ucx_dlist_equals(UcxDlist *l1, UcxDlist *l2, cmp_func fnc, void* data) { 1.20 + if (l1 == l2) return 1; 1.21 + 1.22 + while (l1 != NULL && l2 != NULL) { 1.23 + if (fnc == NULL) { 1.24 + if (l1->data != l2->data) return 0; 1.25 + } else { 1.26 + if (fnc(l1->data, l2->data, data) != 0) return 0; 1.27 + } 1.28 + l1 = l1->next; 1.29 + l2 = l2->next; 1.30 + } 1.31 + 1.32 + return (l1 == NULL && l2 == NULL); 1.33 +} 1.34 + 1.35 void ucx_dlist_free(UcxDlist *l) { 1.36 UcxDlist *e = l, *f; 1.37 while (e != NULL) {