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

Function quicklistDelIndex

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

Delete one entry from list given the node for the entry and a pointer * to the entry in the node. * * Note: quicklistDelIndex() *requires* uncompressed nodes because you * already had to get *p from an uncompressed node somewhere. * * Returns 1 if the entire node was deleted, 0 if node still exists. * Also updates in/out param 'p' with the next offset in the ziplist. */

Source from the content-addressed store, hash-verified

635 * Returns 1 if the entire node was deleted, 0 if node still exists.
636 * Also updates in/out param 'p' with the next offset in the ziplist. */
637REDIS_STATIC int quicklistDelIndex(quicklist *quicklist, quicklistNode *node,
638 unsigned char **p) {
639 int gone = 0;
640
641 node->zl = ziplistDelete(node->zl, p);
642 node->count--;
643 if (node->count == 0) {
644 gone = 1;
645 __quicklistDelNode(quicklist, node);
646 } else {
647 quicklistNodeUpdateSz(node);
648 }
649 quicklist->count--;
650 /* If we deleted the node, the original node is no longer valid */
651 return gone ? 1 : 0;
652}
653
654/* Delete one element represented by 'entry'
655 *

Callers 3

quicklistDelEntryFunction · 0.85
quicklistRotateFunction · 0.85
quicklistPopCustomFunction · 0.85

Calls 2

ziplistDeleteFunction · 0.85
__quicklistDelNodeFunction · 0.85

Tested by

no test coverage detected