|
@@ -468,14 +468,14 @@ faux_list_node_t *faux_list_match_node(const faux_list_t *list,
|
|
if (!iter)
|
|
if (!iter)
|
|
iter = list->head;
|
|
iter = list->head;
|
|
while (iter) {
|
|
while (iter) {
|
|
- int res;
|
|
|
|
|
|
+ int res = 0;
|
|
faux_list_node_t *node = iter;
|
|
faux_list_node_t *node = iter;
|
|
|
|
|
|
iter = faux_list_next_node(iter);
|
|
iter = faux_list_next_node(iter);
|
|
if (saveptr)
|
|
if (saveptr)
|
|
*saveptr = iter;
|
|
*saveptr = iter;
|
|
res = matchFn(userkey, faux_list_data(node));
|
|
res = matchFn(userkey, faux_list_data(node));
|
|
- if (!res)
|
|
|
|
|
|
+ if (0 == res)
|
|
return node;
|
|
return node;
|
|
if (res < 0) // No chances to find match
|
|
if (res < 0) // No chances to find match
|
|
return NULL;
|
|
return NULL;
|
|
@@ -494,10 +494,11 @@ faux_list_node_t *faux_list_match_node(const faux_list_t *list,
|
|
void *faux_list_match(const faux_list_t *list, faux_list_match_fn matchFn,
|
|
void *faux_list_match(const faux_list_t *list, faux_list_match_fn matchFn,
|
|
const void *userkey, faux_list_node_t **saveptr) {
|
|
const void *userkey, faux_list_node_t **saveptr) {
|
|
|
|
|
|
- faux_list_node_t *res =
|
|
|
|
- faux_list_match_node(list, matchFn, userkey, saveptr);
|
|
|
|
|
|
+ faux_list_node_t *res = faux_list_match_node(list, matchFn,
|
|
|
|
+ userkey, saveptr);
|
|
if (!res)
|
|
if (!res)
|
|
return NULL;
|
|
return NULL;
|
|
|
|
+
|
|
return faux_list_data(res);
|
|
return faux_list_data(res);
|
|
}
|
|
}
|
|
|
|
|