src/adlist.c
listNode *listNext(listIter *iter)
{
    listNode *current = iter->next;

    if (current != NULL) {
        if (iter->direction == AL_START_HEAD)
            iter->next = current->next;
        else
            iter->next = current->prev;
    }
    return current;
}
/* Return the next element of an iterator.
 * It's valid to remove the currently returned element using
 * listDelNode(), but not to remove other elements.
 *
 * The function returns a pointer to the next element of the list,
 * or NULL if there are no more elements, so the classical usage patter
 * is:
 *
 * iter = listGetIterator(list,<direction>);
 * while ((node = listNext(iter)) != NULL) {
 *     doSomethingWith(listNodeValue(node));
 * }
 *
 * */
Return the next element of an iterator.
It's valid to remove the currently returned element using
listDelNode(), but not to remove other elements.

The function returns a pointer to the next element of the list,
or NULL if there are no more elements, so the classical usage patter
is.


Return the next element of an iterator . It ' s valid to remove the currently returned element using listDelNode () but not to remove other elements . The function returns a pointer to the next element of the list or NULL if there are no more elements so the classical usage patter is .
listNode *listNext(listIter *iter)
{
    listNode *current = iter->next;
    if (current != NULL) {
        if (iter->direction == AL_START_HEAD)
            iter->next = current->next;
        else
            iter->next = current->prev;
    }
    return current;
}
listNode * listNext ( listIter * iter ) { listNode * current = iter -> next ; if ( current != NULL ) { if ( iter -> direction == AL_START_HEAD ) iter -> next = current -> next ; else iter -> next = current -> prev ; } return current ; }
Return the next element of an iterator.
Return the next element of an iterator .