src/adlist.c
listNode *listSearchKey(list *list, void *key)
{
    listIter iter;
    listNode *node;

    listRewind(list, &iter);
    while((node = listNext(&iter)) != NULL) {
        if (list->match) {
            if (list->match(node->value, key)) {
                return node;
            }
        } else {
            if (key == node->value) {
                return node;
            }
        }
    }
    return NULL;
}
/* Search the list for a node matching a given key.
 * The match is performed using the 'match' method
 * set with listSetMatchMethod(). If no 'match' method
 * is set, the 'value' pointer of every node is directly
 * compared with the 'key' pointer.
 *
 * On success the first matching node pointer is returned
 * (search starts from head). If no matching node exists
 * NULL is returned. */
Search the list for a node matching a given key.
The match is performed using the 'match' method
set with listSetMatchMethod().

On success the first matching node pointer is returned
(search starts from head). If no matching node exists
NULL is returned.
Search the list for a node matching a given key . The match is performed using the ' match ' method set with listSetMatchMethod () . On success the first matching node pointer is returned ( search starts from head ) . If no matching node exists NULL is returned .
listNode *listSearchKey(list *list, void *key)
{
    listIter iter;
    listNode *node;
    listRewind(list, &iter);
    while((node = listNext(&iter)) != NULL) {
        if (list->match) {
            if (list->match(node->value, key)) {
                return node;
            }
        } else {
            if (key == node->value) {
                return node;
            }
        }
    }
    return NULL;
}
listNode * listSearchKey ( list * list , void * key ) { listIter iter ; listNode * node ; listRewind ( list , & iter ) ; while ( ( node = listNext ( & iter ) ) != NULL ) { if ( list -> match ) { if ( list -> match ( node -> value , key ) ) { return node ; } } else { if ( key == node -> value ) { return node ; } } } return NULL ; }
Search the list for a node matching a given key.
Search the list for a node matching a given key .