+/* Delete the element pointed to. */
+static void lDelete(lIterator *li, int direction) {
+ if (li->encoding == REDIS_ENCODING_ZIPLIST) {
+ direction = (direction == REDIS_HEAD) ? ZIPLIST_HEAD : ZIPLIST_TAIL;
+ li->subject->ptr = ziplistDelete(li->subject->ptr,&li->zi,direction);
+ } else if (li->encoding == REDIS_ENCODING_LIST) {
+ listNode *next;
+ if (direction == REDIS_HEAD)
+ next = li->ln->prev;
+ else
+ next = li->ln->next;
+ listDelNode(li->subject->ptr,li->ln);
+ li->ln = next;
+ } else {
+ redisPanic("Unknown list encoding");
+ }
+}
+
+/* Compare the given object with the entry at the current position. */
+static int lEqualTo(lIterator *li, robj *o) {
+ if (li->encoding == REDIS_ENCODING_ZIPLIST) {
+ redisAssert(o->encoding == REDIS_ENCODING_RAW);
+ return ziplistCompare(li->zi,o->ptr,sdslen(o->ptr));
+ } else if (li->encoding == REDIS_ENCODING_LIST) {
+ return equalStringObjects(o,listNodeValue(li->ln));
+ } else {
+ redisPanic("Unknown list encoding");
+ }
+}
+