diff -r 5418bda21896 -r b79b1ce438dd ucx/list.c --- a/ucx/list.c Tue Jul 23 12:54:45 2013 +0200 +++ b/ucx/list.c Tue Jul 23 14:43:45 2013 +0200 @@ -118,13 +118,13 @@ } UcxList *ucx_list_concat(UcxList *l1, UcxList *l2) { - if (l1 == NULL) { - return l2; - } else { + if (l1) { UcxList *last = ucx_list_last(l1); last->next = l2; l2->prev = last; return l1; + } else { + return l2; } } @@ -154,7 +154,7 @@ if (l == NULL) return NULL; const UcxList *e = l; - while (e->next != NULL && index > 0) { + while (e->next && index > 0) { e = e->next; index--; } @@ -165,8 +165,14 @@ ssize_t ucx_list_find(UcxList *l, void *elem, cmp_func fnc, void *cmpdata) { ssize_t index = 0; UCX_FOREACH(e, l) { - if (fnc(elem, e->data, cmpdata) == 0) { - return index; + if (fnc) { + if (fnc(elem, e->data, cmpdata) == 0) { + return index; + } + } else { + if (elem == e->data) { + return index; + } } index++; }