+static void convertList(robj *subject, int enc) {
+ lIterator *li;
+ lEntry entry;
+ redisAssert(subject->type == REDIS_LIST);
+
+ if (enc == REDIS_ENCODING_LIST) {
+ list *l = listCreate();
+
+ /* lGet returns a robj with incremented refcount */
+ li = lInitIterator(subject,0,REDIS_TAIL);
+ while (lNext(li,&entry)) listAddNodeTail(l,lGet(&entry));
+ lReleaseIterator(li);
+
+ subject->encoding = REDIS_ENCODING_LIST;
+ zfree(subject->ptr);
+ subject->ptr = l;
+ } else {
+ redisPanic("Unsupported list conversion");
+ }
+}
+