src/list.c

changeset 323
b8c49e7a1dba
parent 291
deb0035635eb
child 335
872ae61c8945
     1.1 --- a/src/list.c	Wed May 16 19:33:31 2018 +0200
     1.2 +++ b/src/list.c	Thu May 17 11:13:02 2018 +0200
     1.3 @@ -107,74 +107,6 @@
     1.4      }
     1.5  }
     1.6  
     1.7 -UcxList *ucx_list_append_once(UcxList *l, void *data,
     1.8 -        cmp_func cmpfnc, void *cmpdata) {
     1.9 -    return ucx_list_append_once_a(ucx_default_allocator(), l,
    1.10 -            data, cmpfnc, cmpdata);
    1.11 -}
    1.12 -
    1.13 -UcxList *ucx_list_append_once_a(UcxAllocator *alloc, UcxList *l, void *data,
    1.14 -        cmp_func cmpfnc, void *cmpdata) {
    1.15 -
    1.16 -    UcxList *last = NULL;
    1.17 -    {
    1.18 -        UcxList *e = l;
    1.19 -        while (e) {
    1.20 -            if (cmpfnc(e->data, data, cmpdata) == 0) {
    1.21 -                return l;
    1.22 -            }
    1.23 -            last = e;
    1.24 -            e = e->next;
    1.25 -        }
    1.26 -    }
    1.27 -    
    1.28 -    UcxList *nl = ucx_list_append_a(alloc, NULL, data);
    1.29 -    if (!nl) {
    1.30 -        return NULL;
    1.31 -    }
    1.32 -
    1.33 -    if (last == NULL) {
    1.34 -        return nl;
    1.35 -    } else {
    1.36 -        nl->prev = last;
    1.37 -        last->next = nl;
    1.38 -        return l;
    1.39 -    }
    1.40 -}
    1.41 -
    1.42 -UcxList *ucx_list_prepend_once(UcxList *l, void *data,
    1.43 -        cmp_func cmpfnc, void *cmpdata) {
    1.44 -    return ucx_list_prepend_once_a(ucx_default_allocator(), l,
    1.45 -            data, cmpfnc, cmpdata);
    1.46 -}
    1.47 -
    1.48 -UcxList *ucx_list_prepend_once_a(UcxAllocator *alloc, UcxList *l, void *data,
    1.49 -        cmp_func cmpfnc, void *cmpdata) {
    1.50 -
    1.51 -    UcxList* first = ucx_list_first(l);
    1.52 -    {
    1.53 -        UcxList *e = first;
    1.54 -        while (e) {
    1.55 -            if (cmpfnc(e->data, data, cmpdata) == 0) {
    1.56 -                return l;
    1.57 -            }
    1.58 -            e = e->next;
    1.59 -        }
    1.60 -    }
    1.61 -    
    1.62 -    UcxList *nl = ucx_list_append_a(alloc, NULL, data);
    1.63 -    if (!nl) {
    1.64 -        return NULL;
    1.65 -    }
    1.66 -
    1.67 -    if (first) {
    1.68 -        nl->next = first;
    1.69 -        first->prev = nl;
    1.70 -    }
    1.71 -    
    1.72 -    return nl;
    1.73 -}
    1.74 -
    1.75  UcxList *ucx_list_prepend(UcxList *l, void *data) {
    1.76      return ucx_list_prepend_a(ucx_default_allocator(), l, data);
    1.77  }

mercurial