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

Function quicklistGetIterator

app/redis-6.2.6/src/quicklist.c:1072–1091  ·  view source on GitHub ↗

Returns a quicklist iterator 'iter'. After the initialization every * call to quicklistNext() will return the next element of the quicklist. */

Source from the content-addressed store, hash-verified

1070/* Returns a quicklist iterator 'iter'. After the initialization every
1071 * call to quicklistNext() will return the next element of the quicklist. */
1072quicklistIter *quicklistGetIterator(const quicklist *quicklist, int direction) {
1073 quicklistIter *iter;
1074
1075 iter = zmalloc(sizeof(*iter));
1076
1077 if (direction == AL_START_HEAD) {
1078 iter->current = quicklist->head;
1079 iter->offset = 0;
1080 } else if (direction == AL_START_TAIL) {
1081 iter->current = quicklist->tail;
1082 iter->offset = -1;
1083 }
1084
1085 iter->direction = direction;
1086 iter->quicklist = quicklist;
1087
1088 iter->zi = NULL;
1089
1090 return iter;
1091}
1092
1093/* Initialize an iterator at a specific offset 'idx' and make the iterator
1094 * return nodes in 'direction' direction. */

Callers 4

rewriteListObjectFunction · 0.85
_itrprintrFunction · 0.85
quicklistTestFunction · 0.85

Calls 1

zmallocFunction · 0.85

Tested by

no test coverage detected