ucx/dlist.c

changeset 87
bd444539cced
parent 73
f15c7d6aebb9
child 93
a6a99e721660
     1.1 --- a/ucx/dlist.c	Mon Feb 25 13:25:07 2013 +0100
     1.2 +++ b/ucx/dlist.c	Mon Feb 25 16:26:50 2013 +0100
     1.3 @@ -1,7 +1,6 @@
     1.4  #include "dlist.h"
     1.5  
     1.6 -UcxDlist *restrict ucx_dlist_clone(UcxDlist *restrict l,
     1.7 -        copy_func fnc, void *data) {
     1.8 +UcxDlist *ucx_dlist_clone(UcxDlist *l, copy_func fnc, void *data) {
     1.9      UcxDlist *ret = NULL;
    1.10      while (l != NULL) {
    1.11          if (fnc != NULL) {
    1.12 @@ -101,6 +100,15 @@
    1.13      return (UcxDlist*)(index == 0 ? e : NULL);
    1.14  }
    1.15  
    1.16 +int ucx_dlist_contains(UcxDlist *l, void *elem, cmp_func fnc, void *cmpdata) {
    1.17 +    UCX_FOREACH(UcxDlist*, l, e) {
    1.18 +        if (!fnc(elem, e->data, cmpdata)) {
    1.19 +            return 1;
    1.20 +        }
    1.21 +    }
    1.22 +    return 0;
    1.23 +}
    1.24 +
    1.25  size_t ucx_dlist_size(const UcxDlist *l) {
    1.26      if (l == NULL) return 0;
    1.27      

mercurial