MCPcopy Create free account
hub / github.com/F-Stack/f-stack / listNext

Function listNext

app/redis-6.2.6/src/adlist.c:230–241  ·  view source on GitHub ↗

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 * pattern is: * * iter = listGetIterator(list, ); * while ((node = listNext(iter)) != NULL) { *

Source from the content-addressed store, hash-verified

228 *
229 * */
230listNode *listNext(listIter *iter)
231{
232 listNode *current = iter->next;
233
234 if (current != NULL) {
235 if (iter->direction == AL_START_HEAD)
236 iter->next = current->next;
237 else
238 iter->next = current->prev;
239 }
240 return current;
241}
242
243/* Duplicate the whole list. On out of memory NULL is returned.
244 * On success a copy of the original list is returned.

Callers 15

listDupFunction · 0.85
listSearchKeyFunction · 0.85
freeClusterManagerNodeFunction · 0.85
freeClusterManagerFunction · 0.85
clusterManagerNodeByNameFunction · 0.85
clusterManagerShowNodesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected