@@ -198,7 +198,7 @@ void listTypeInsert(listTypeEntry *entry, robj *value, int where) {
int listTypeEqual(listTypeEntry *entry, robj *o) {
listTypeIterator *li = entry->li;
if (li->encoding == REDIS_ENCODING_ZIPLIST) {
redisAssert(o->encoding == REDIS_ENCODING_RAW);
redisAssertWithInfo(NULL,o,o->encoding == REDIS_ENCODING_RAW);
return ziplistCompare(entry->zi,o->ptr,sdslen(o->ptr));
} else if (li->encoding == REDIS_ENCODING_LINKEDLIST) {
return equalStringObjects(o,listNodeValue(entry->ln));
@@ -235,7 +235,7 @@ void listTypeDelete(listTypeEntry *entry) {
void listTypeConvert(robj *subject, int enc) {
listTypeIterator *li;
listTypeEntry entry;
redisAssert(subject->type == REDIS_LIST);
redisAssertWithInfo(NULL,subject,subject->type == REDIS_LIST);

if (enc == REDIS_ENCODING_LINKEDLIST) {
list *l = listCreate();
@@ -310,7 +310,7 @@ void pushxGenericCommand(redisClient *c, robj *refval, robj *val, int where) {
if (refval != NULL) {
/* Note: we expect refval to be string-encoded because it is *not* the
* last argument of the multi-bulk LINSERT. */
redisAssert(refval->encoding == REDIS_ENCODING_RAW);
redisAssertWithInfo(c,refval,refval->encoding == REDIS_ENCODING_RAW);

/* We're not sure if this value can be inserted yet, but we cannot
* convert the list inside the iterator. We don't want to loop over
@@ -774,7 +774,7 @@ void blockForKeys(redisClient *c, robj **keys, int numkeys, time_t timeout, robj
l = listCreate();
retval = dictAdd(c->db->blocking_keys,keys[j],l);
incrRefCount(keys[j]);
redisAssert(retval == DICT_OK);
redisAssertWithInfo(c,keys[j],retval == DICT_OK);
} else {
l = dictGetEntryVal(de);
}
@@ -791,12 +791,12 @@ void unblockClientWaitingData(redisClient *c) {
list *l;
int j;

redisAssert(c->bpop.keys != NULL);
redisAssertWithInfo(c,NULL,c->bpop.keys != NULL);
/* The client may wait for multiple keys, so unblock it for every key. */
for (j = 0; j < c->bpop.count; j++) {
/* Remove this client from the list of clients waiting for this key. */
de = dictFind(c->db->blocking_keys,c->bpop.keys[j]);
redisAssert(de != NULL);
redisAssertWithInfo(c,c->bpop.keys[j],de != NULL);
l = dictGetEntryVal(de);
listDelNode(l,listSearchKey(l,c));
/* If the list is empty we need to remove it to avoid wasting memory */
@@ -848,7 +848,7 @@ int handleClientsWaitingListPush(redisClient *c, robj *key, robj *ele) {
* this happens, it simply tries the next client waiting for a push. */
while (numclients--) {
ln = listFirst(clients);
redisAssert(ln != NULL);
redisAssertWithInfo(c,key,ln != NULL);
receiver = ln->value;
dstkey = receiver->bpop.target;

@@ -995,7 +995,7 @@ void brpoplpushCommand(redisClient *c) {

/* The list exists and has elements, so
* the regular rpoplpushCommand is executed. */
redisAssert(listTypeLength(key) > 0);
redisAssertWithInfo(c,key,listTypeLength(key) > 0);
rpoplpushCommand(c);
}
}
@@ -37,7 +37,7 @@ int setTypeAdd(robj *subject, robj *value) {

/* The set *was* an intset and this value is not integer
* encodable, so dictAdd should always work. */
redisAssert(dictAdd(subject->ptr,value,NULL) == DICT_OK);
redisAssertWithInfo(NULL,value,dictAdd(subject->ptr,value,NULL) == DICT_OK);
incrRefCount(value);
return 1;
}
@@ -189,8 +189,8 @@ unsigned long setTypeSize(robj *subject) {
* set. */
void setTypeConvert(robj *setobj, int enc) {
setTypeIterator *si;
redisAssert(setobj->type == REDIS_SET &&
setobj->encoding == REDIS_ENCODING_INTSET);
redisAssertWithInfo(NULL,setobj,setobj->type == REDIS_SET &&
setobj->encoding == REDIS_ENCODING_INTSET);

if (enc == REDIS_ENCODING_HT) {
int64_t intele;
@@ -204,7 +204,7 @@ void setTypeConvert(robj *setobj, int enc) {
si = setTypeInitIterator(setobj);
while (setTypeNext(si,NULL,&intele) != -1) {
element = createStringObjectFromLongLong(intele);
redisAssert(dictAdd(d,element,NULL) == DICT_OK);
redisAssertWithInfo(NULL,element,dictAdd(d,element,NULL) == DICT_OK);
}
setTypeReleaseIterator(si);

@@ -578,7 +578,7 @@ unsigned char *zzlFind(unsigned char *zl, robj *ele, double *score) {
ele = getDecodedObject(ele);
while (eptr != NULL) {
sptr = ziplistNext(zl,eptr);
redisAssert(sptr != NULL);
redisAssertWithInfo(NULL,ele,sptr != NULL);

if (ziplistCompare(eptr,ele->ptr,sdslen(ele->ptr))) {
/* Matching element, pull out score. */
@@ -612,7 +612,7 @@ unsigned char *zzlInsertAt(unsigned char *zl, unsigned char *eptr, robj *ele, do
int scorelen;
size_t offset;

redisAssert(ele->encoding == REDIS_ENCODING_RAW);
redisAssertWithInfo(NULL,ele,ele->encoding == REDIS_ENCODING_RAW);
scorelen = d2string(scorebuf,sizeof(scorebuf),score);
if (eptr == NULL) {
zl = ziplistPush(zl,ele->ptr,sdslen(ele->ptr),ZIPLIST_TAIL);
@@ -624,7 +624,7 @@ unsigned char *zzlInsertAt(unsigned char *zl, unsigned char *eptr, robj *ele, do
eptr = zl+offset;

/* Insert score after the element. */
redisAssert((sptr = ziplistNext(zl,eptr)) != NULL);
redisAssertWithInfo(NULL,ele,(sptr = ziplistNext(zl,eptr)) != NULL);
zl = ziplistInsert(zl,sptr,(unsigned char*)scorebuf,scorelen);
}

@@ -640,7 +640,7 @@ unsigned char *zzlInsert(unsigned char *zl, robj *ele, double score) {
ele = getDecodedObject(ele);
while (eptr != NULL) {
sptr = ziplistNext(zl,eptr);
redisAssert(sptr != NULL);
redisAssertWithInfo(NULL,ele,sptr != NULL);
s = zzlGetScore(sptr);

if (s > score) {
@@ -745,21 +745,21 @@ void zsetConvert(robj *zobj, int encoding) {
zs->zsl = zslCreate();

eptr = ziplistIndex(zl,0);
redisAssert(eptr != NULL);
redisAssertWithInfo(NULL,zobj,eptr != NULL);
sptr = ziplistNext(zl,eptr);
redisAssert(sptr != NULL);
redisAssertWithInfo(NULL,zobj,sptr != NULL);

while (eptr != NULL) {
score = zzlGetScore(sptr);
redisAssert(ziplistGet(eptr,&vstr,&vlen,&vlong));
redisAssertWithInfo(NULL,zobj,ziplistGet(eptr,&vstr,&vlen,&vlong));
if (vstr == NULL)
ele = createStringObjectFromLongLong(vlong);
else
ele = createStringObject((char*)vstr,vlen);

/* Has incremented refcount since it was just created. */
node = zslInsert(zs->zsl,score,ele);
redisAssert(dictAdd(zs->dict,ele,&node->score) == DICT_OK);
redisAssertWithInfo(NULL,zobj,dictAdd(zs->dict,ele,&node->score) == DICT_OK);
incrRefCount(ele); /* Added to dictionary. */
zzlNext(zl,&eptr,&sptr);
}
@@ -918,7 +918,7 @@ void zaddGenericCommand(redisClient *c, int incr) {
* delete the key object from the skiplist, since the
* dictionary still has a reference to it. */
if (score != curscore) {
redisAssert(zslDelete(zs->zsl,curscore,curobj));
redisAssertWithInfo(c,curobj,zslDelete(zs->zsl,curscore,curobj));
znode = zslInsert(zs->zsl,score,curobj);
incrRefCount(curobj); /* Re-inserted in skiplist. */
dictGetEntryVal(de) = &znode->score; /* Update score ptr. */
@@ -929,7 +929,7 @@ void zaddGenericCommand(redisClient *c, int incr) {
} else {
znode = zslInsert(zs->zsl,score,ele);
incrRefCount(ele); /* Inserted in skiplist. */
redisAssert(dictAdd(zs->dict,ele,&znode->score) == DICT_OK);
redisAssertWithInfo(c,curobj,dictAdd(zs->dict,ele,&znode->score) == DICT_OK);
incrRefCount(ele); /* Added to dictionary. */

signalModifiedKey(c->db,key);
@@ -988,7 +988,7 @@ void zremCommand(redisClient *c) {

/* Delete from the skiplist */
score = *(double*)dictGetEntryVal(de);
redisAssert(zslDelete(zs->zsl,score,c->argv[j]));
redisAssertWithInfo(c,c->argv[j],zslDelete(zs->zsl,score,c->argv[j]));

/* Delete from the hash table */
dictDelete(zs->dict,c->argv[j]);
@@ -1698,12 +1698,12 @@ void zrangeGenericCommand(redisClient *c, int reverse) {
else
eptr = ziplistIndex(zl,2*start);

redisAssert(eptr != NULL);
redisAssertWithInfo(c,zobj,eptr != NULL);
sptr = ziplistNext(zl,eptr);

while (rangelen--) {
redisAssert(eptr != NULL && sptr != NULL);
redisAssert(ziplistGet(eptr,&vstr,&vlen,&vlong));
redisAssertWithInfo(c,zobj,eptr != NULL && sptr != NULL);
redisAssertWithInfo(c,zobj,ziplistGet(eptr,&vstr,&vlen,&vlong));
if (vstr == NULL)
addReplyBulkLongLong(c,vlong);
else
@@ -1736,7 +1736,7 @@ void zrangeGenericCommand(redisClient *c, int reverse) {
}

while(rangelen--) {
redisAssert(ln != NULL);
redisAssertWithInfo(c,zobj,ln != NULL);
ele = ln->obj;
addReplyBulk(c,ele);
if (withscores)
@@ -1828,7 +1828,7 @@ void genericZrangebyscoreCommand(redisClient *c, int reverse) {
}

/* Get score pointer for the first element. */
redisAssert(eptr != NULL);
redisAssertWithInfo(c,zobj,eptr != NULL);
sptr = ziplistNext(zl,eptr);

/* We don't know in advance how many matching elements there are in the
@@ -1857,7 +1857,7 @@ void genericZrangebyscoreCommand(redisClient *c, int reverse) {
}

/* We know the element exists, so ziplistGet should always succeed */
redisAssert(ziplistGet(eptr,&vstr,&vlen,&vlong));
redisAssertWithInfo(c,zobj,ziplistGet(eptr,&vstr,&vlen,&vlong));

rangelen++;
if (vstr == NULL) {
@@ -1984,7 +1984,7 @@ void zcountCommand(redisClient *c) {
/* First element is in range */
sptr = ziplistNext(zl,eptr);
score = zzlGetScore(sptr);
redisAssert(zslValueLteMax(score,&range));
redisAssertWithInfo(c,zobj,zslValueLteMax(score,&range));

/* Iterate over elements in range */
while (eptr) {
@@ -2079,15 +2079,15 @@ void zrankGenericCommand(redisClient *c, int reverse) {
checkType(c,zobj,REDIS_ZSET)) return;
llen = zsetLength(zobj);

redisAssert(ele->encoding == REDIS_ENCODING_RAW);
redisAssertWithInfo(c,ele,ele->encoding == REDIS_ENCODING_RAW);
if (zobj->encoding == REDIS_ENCODING_ZIPLIST) {
unsigned char *zl = zobj->ptr;
unsigned char *eptr, *sptr;

eptr = ziplistIndex(zl,0);
redisAssert(eptr != NULL);
redisAssertWithInfo(c,zobj,eptr != NULL);
sptr = ziplistNext(zl,eptr);
redisAssert(sptr != NULL);
redisAssertWithInfo(c,zobj,sptr != NULL);

rank = 1;
while(eptr != NULL) {
@@ -2116,7 +2116,7 @@ void zrankGenericCommand(redisClient *c, int reverse) {
if (de != NULL) {
score = *(double*)dictGetEntryVal(de);
rank = zslGetRank(zsl,score,ele);
redisAssert(rank); /* Existing elements always have a rank. */
redisAssertWithInfo(c,ele,rank); /* Existing elements always have a rank. */
if (reverse)
addReplyLongLong(c,llen-rank);
else