MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / quicklistGetIteratorAtIdx

Function quicklistGetIteratorAtIdx

src/quicklist.c:1095–1109  ·  view source on GitHub ↗

Initialize an iterator at a specific offset 'idx' and make the iterator * return nodes in 'direction' direction. */

Source from the content-addressed store, hash-verified

1093/* Initialize an iterator at a specific offset 'idx' and make the iterator
1094 * return nodes in 'direction' direction. */
1095quicklistIter *quicklistGetIteratorAtIdx(const quicklist *quicklist,
1096 const int direction,
1097 const long long idx) {
1098 quicklistEntry entry;
1099
1100 if (quicklistIndex(quicklist, idx, &entry)) {
1101 quicklistIter *base = quicklistGetIterator(quicklist, direction);
1102 base->zi = NULL;
1103 base->current = entry.node;
1104 base->offset = entry.offset;
1105 return base;
1106 } else {
1107 return NULL;
1108 }
1109}
1110
1111/* Release iterator.
1112 * If we still have a valid current node, then re-encode current node. */

Callers 2

quicklistTestFunction · 0.85
listTypeInitIteratorFunction · 0.85

Calls 2

quicklistIndexFunction · 0.85
quicklistGetIteratorFunction · 0.85

Tested by

no test coverage detected