"vscode:/vscode.git/clone" did not exist on "ab48d029d97ece21ac9cb0609cdb7fe714733758"
Commit 2d9e3eb1 authored by antirez's avatar antirez
Browse files

RDMF: redisAssert -> serverAssert.

parent 14ff5724
......@@ -70,7 +70,7 @@ int hashTypeGetFromZiplist(robj *o, robj *field,
unsigned char *zl, *fptr = NULL, *vptr = NULL;
int ret;
redisAssert(o->encoding == OBJ_ENCODING_ZIPLIST);
serverAssert(o->encoding == OBJ_ENCODING_ZIPLIST);
field = getDecodedObject(field);
......@@ -81,7 +81,7 @@ int hashTypeGetFromZiplist(robj *o, robj *field,
if (fptr != NULL) {
/* Grab pointer to the value (fptr points to the field) */
vptr = ziplistNext(zl, fptr);
redisAssert(vptr != NULL);
serverAssert(vptr != NULL);
}
}
......@@ -89,7 +89,7 @@ int hashTypeGetFromZiplist(robj *o, robj *field,
if (vptr != NULL) {
ret = ziplistGet(vptr, vstr, vlen, vll);
redisAssert(ret);
serverAssert(ret);
return 0;
}
......@@ -101,7 +101,7 @@ int hashTypeGetFromZiplist(robj *o, robj *field,
int hashTypeGetFromHashTable(robj *o, robj *field, robj **value) {
dictEntry *de;
redisAssert(o->encoding == OBJ_ENCODING_HT);
serverAssert(o->encoding == OBJ_ENCODING_HT);
de = dictFind(o->ptr, field);
if (de == NULL) return -1;
......@@ -205,7 +205,7 @@ int hashTypeSet(robj *o, robj *field, robj *value) {
if (fptr != NULL) {
/* Grab pointer to the value (fptr points to the field) */
vptr = ziplistNext(zl, fptr);
redisAssert(vptr != NULL);
serverAssert(vptr != NULL);
update = 1;
/* Delete value */
......@@ -333,18 +333,18 @@ int hashTypeNext(hashTypeIterator *hi) {
if (fptr == NULL) {
/* Initialize cursor */
redisAssert(vptr == NULL);
serverAssert(vptr == NULL);
fptr = ziplistIndex(zl, 0);
} else {
/* Advance cursor */
redisAssert(vptr != NULL);
serverAssert(vptr != NULL);
fptr = ziplistNext(zl, vptr);
}
if (fptr == NULL) return REDIS_ERR;
/* Grab pointer to the value (fptr points to the field) */
vptr = ziplistNext(zl, fptr);
redisAssert(vptr != NULL);
serverAssert(vptr != NULL);
/* fptr, vptr now point to the first or next pair */
hi->fptr = fptr;
......@@ -366,21 +366,21 @@ void hashTypeCurrentFromZiplist(hashTypeIterator *hi, int what,
{
int ret;
redisAssert(hi->encoding == OBJ_ENCODING_ZIPLIST);
serverAssert(hi->encoding == OBJ_ENCODING_ZIPLIST);
if (what & OBJ_HASH_KEY) {
ret = ziplistGet(hi->fptr, vstr, vlen, vll);
redisAssert(ret);
serverAssert(ret);
} else {
ret = ziplistGet(hi->vptr, vstr, vlen, vll);
redisAssert(ret);
serverAssert(ret);
}
}
/* Get the field or value at iterator cursor, for an iterator on a hash value
* encoded as a ziplist. Prototype is similar to `hashTypeGetFromHashTable`. */
void hashTypeCurrentFromHashTable(hashTypeIterator *hi, int what, robj **dst) {
redisAssert(hi->encoding == OBJ_ENCODING_HT);
serverAssert(hi->encoding == OBJ_ENCODING_HT);
if (what & OBJ_HASH_KEY) {
*dst = dictGetKey(hi->de);
......@@ -430,7 +430,7 @@ robj *hashTypeLookupWriteOrCreate(client *c, robj *key) {
}
void hashTypeConvertZiplist(robj *o, int enc) {
redisAssert(o->encoding == OBJ_ENCODING_ZIPLIST);
serverAssert(o->encoding == OBJ_ENCODING_ZIPLIST);
if (enc == OBJ_ENCODING_ZIPLIST) {
/* Nothing to do... */
......@@ -454,7 +454,7 @@ void hashTypeConvertZiplist(robj *o, int enc) {
if (ret != DICT_OK) {
serverLogHexDump(REDIS_WARNING,"ziplist with dup elements dump",
o->ptr,ziplistBlobLen(o->ptr));
redisAssert(ret == DICT_OK);
serverAssert(ret == DICT_OK);
}
}
......@@ -768,7 +768,7 @@ void genericHgetallCommand(client *c, int flags) {
}
hashTypeReleaseIterator(hi);
redisAssert(count == length);
serverAssert(count == length);
}
void hkeysCommand(client *c) {
......
......@@ -111,7 +111,7 @@ void listTypeReleaseIterator(listTypeIterator *li) {
* entry is in fact an entry, 0 otherwise. */
int listTypeNext(listTypeIterator *li, listTypeEntry *entry) {
/* Protect from converting when iterating */
redisAssert(li->subject->encoding == li->encoding);
serverAssert(li->subject->encoding == li->encoding);
entry->li = li;
if (li->encoding == OBJ_ENCODING_QUICKLIST) {
......@@ -159,7 +159,7 @@ void listTypeInsert(listTypeEntry *entry, robj *value, int where) {
/* Compare the given object with the entry at the current position. */
int listTypeEqual(listTypeEntry *entry, robj *o) {
if (entry->li->encoding == OBJ_ENCODING_QUICKLIST) {
redisAssertWithInfo(NULL,o,sdsEncodedObject(o));
serverAssertWithInfo(NULL,o,sdsEncodedObject(o));
return quicklistCompare(entry->entry.zi,o->ptr,sdslen(o->ptr));
} else {
redisPanic("Unknown list encoding");
......@@ -177,8 +177,8 @@ void listTypeDelete(listTypeIterator *iter, listTypeEntry *entry) {
/* Create a quicklist from a single ziplist */
void listTypeConvert(robj *subject, int enc) {
redisAssertWithInfo(NULL,subject,subject->type==OBJ_LIST);
redisAssertWithInfo(NULL,subject,subject->encoding==OBJ_ENCODING_ZIPLIST);
serverAssertWithInfo(NULL,subject,subject->type==OBJ_LIST);
serverAssertWithInfo(NULL,subject,subject->encoding==OBJ_ENCODING_ZIPLIST);
if (enc == OBJ_ENCODING_QUICKLIST) {
size_t zlen = server.list_max_ziplist_size;
......@@ -632,7 +632,7 @@ void blockForKeys(client *c, robj **keys, int numkeys, mstime_t timeout, robj *t
l = listCreate();
retval = dictAdd(c->db->blocking_keys,keys[j],l);
incrRefCount(keys[j]);
redisAssertWithInfo(c,keys[j],retval == DICT_OK);
serverAssertWithInfo(c,keys[j],retval == DICT_OK);
} else {
l = dictGetVal(de);
}
......@@ -648,7 +648,7 @@ void unblockClientWaitingData(client *c) {
dictIterator *di;
list *l;
redisAssertWithInfo(c,NULL,dictSize(c->bpop.keys) != 0);
serverAssertWithInfo(c,NULL,dictSize(c->bpop.keys) != 0);
di = dictGetIterator(c->bpop.keys);
/* The client may wait for multiple keys, so unblock it for every key. */
while((de = dictNext(di)) != NULL) {
......@@ -656,7 +656,7 @@ void unblockClientWaitingData(client *c) {
/* Remove this client from the list of clients waiting for this key. */
l = dictFetchValue(c->db->blocking_keys,key);
redisAssertWithInfo(c,key,l != NULL);
serverAssertWithInfo(c,key,l != NULL);
listDelNode(l,listSearchKey(l,c));
/* If the list is empty we need to remove it to avoid wasting memory */
if (listLength(l) == 0)
......@@ -699,7 +699,7 @@ void signalListAsReady(redisDb *db, robj *key) {
* to avoid adding it multiple times into a list with a simple O(1)
* check. */
incrRefCount(key);
redisAssert(dictAdd(db->ready_keys,key,NULL) == DICT_OK);
serverAssert(dictAdd(db->ready_keys,key,NULL) == DICT_OK);
}
/* This is a helper function for handleClientsBlockedOnLists(). It's work
......@@ -882,7 +882,7 @@ void blockingPopGenericCommand(client *c, int where) {
/* Non empty list, this is like a non normal [LR]POP. */
char *event = (where == REDIS_HEAD) ? "lpop" : "rpop";
robj *value = listTypePop(o,where);
redisAssert(value != NULL);
serverAssert(value != NULL);
addReplyMultiBulkLen(c,2);
addReplyBulk(c,c->argv[j]);
......@@ -950,7 +950,7 @@ void brpoplpushCommand(client *c) {
} else {
/* The list exists and has elements, so
* the regular rpoplpushCommand is executed. */
redisAssertWithInfo(c,key,listTypeLength(key) > 0);
serverAssertWithInfo(c,key,listTypeLength(key) > 0);
rpoplpushCommand(c);
}
}
......
......@@ -74,7 +74,7 @@ int setTypeAdd(robj *subject, robj *value) {
/* The set *was* an intset and this value is not integer
* encodable, so dictAdd should always work. */
redisAssertWithInfo(NULL,value,
serverAssertWithInfo(NULL,value,
dictAdd(subject->ptr,value,NULL) == DICT_OK);
incrRefCount(value);
return 1;
......@@ -241,7 +241,7 @@ unsigned long setTypeSize(robj *subject) {
* set. */
void setTypeConvert(robj *setobj, int enc) {
setTypeIterator *si;
redisAssertWithInfo(NULL,setobj,setobj->type == OBJ_SET &&
serverAssertWithInfo(NULL,setobj,setobj->type == OBJ_SET &&
setobj->encoding == OBJ_ENCODING_INTSET);
if (enc == OBJ_ENCODING_HT) {
......@@ -256,7 +256,7 @@ void setTypeConvert(robj *setobj, int enc) {
si = setTypeInitIterator(setobj);
while (setTypeNext(si,&element,&intele) != -1) {
element = createStringObjectFromLongLong(intele);
redisAssertWithInfo(NULL,element,
serverAssertWithInfo(NULL,element,
dictAdd(d,element,NULL) == DICT_OK);
}
setTypeReleaseIterator(si);
......@@ -696,10 +696,10 @@ void srandmemberWithCountCommand(client *c) {
} else {
retval = dictAdd(d,dupStringObject(ele),NULL);
}
redisAssert(retval == DICT_OK);
serverAssert(retval == DICT_OK);
}
setTypeReleaseIterator(si);
redisAssert(dictSize(d) == size);
serverAssert(dictSize(d) == size);
/* Remove random elements to reach the right count. */
while(size > count) {
......
......@@ -112,7 +112,7 @@ zskiplistNode *zslInsert(zskiplist *zsl, double score, robj *obj) {
unsigned int rank[ZSKIPLIST_MAXLEVEL];
int i, level;
redisAssert(!isnan(score));
serverAssert(!isnan(score));
x = zsl->header;
for (i = zsl->level-1; i >= 0; i--) {
/* store rank that is crossed to reach the insert position */
......@@ -253,7 +253,7 @@ zskiplistNode *zslFirstInRange(zskiplist *zsl, zrangespec *range) {
/* This is an inner range, so the next node cannot be NULL. */
x = x->level[0].forward;
redisAssert(x != NULL);
serverAssert(x != NULL);
/* Check if score <= max. */
if (!zslValueLteMax(x->score,range)) return NULL;
......@@ -278,7 +278,7 @@ zskiplistNode *zslLastInRange(zskiplist *zsl, zrangespec *range) {
}
/* This is an inner range, so this node cannot be NULL. */
redisAssert(x != NULL);
serverAssert(x != NULL);
/* Check if score >= min. */
if (!zslValueGteMin(x->score,range)) return NULL;
......@@ -596,7 +596,7 @@ zskiplistNode *zslFirstInLexRange(zskiplist *zsl, zlexrangespec *range) {
/* This is an inner range, so the next node cannot be NULL. */
x = x->level[0].forward;
redisAssert(x != NULL);
serverAssert(x != NULL);
/* Check if score <= max. */
if (!zslLexValueLteMax(x->obj,range)) return NULL;
......@@ -621,7 +621,7 @@ zskiplistNode *zslLastInLexRange(zskiplist *zsl, zlexrangespec *range) {
}
/* This is an inner range, so this node cannot be NULL. */
redisAssert(x != NULL);
serverAssert(x != NULL);
/* Check if score >= min. */
if (!zslLexValueGteMin(x->obj,range)) return NULL;
......@@ -639,8 +639,8 @@ double zzlGetScore(unsigned char *sptr) {
char buf[128];
double score;
redisAssert(sptr != NULL);
redisAssert(ziplistGet(sptr,&vstr,&vlen,&vlong));
serverAssert(sptr != NULL);
serverAssert(ziplistGet(sptr,&vstr,&vlen,&vlong));
if (vstr) {
memcpy(buf,vstr,vlen);
......@@ -661,8 +661,8 @@ robj *ziplistGetObject(unsigned char *sptr) {
unsigned int vlen;
long long vlong;
redisAssert(sptr != NULL);
redisAssert(ziplistGet(sptr,&vstr,&vlen,&vlong));
serverAssert(sptr != NULL);
serverAssert(ziplistGet(sptr,&vstr,&vlen,&vlong));
if (vstr) {
return createStringObject((char*)vstr,vlen);
......@@ -679,7 +679,7 @@ int zzlCompareElements(unsigned char *eptr, unsigned char *cstr, unsigned int cl
unsigned char vbuf[32];
int minlen, cmp;
redisAssert(ziplistGet(eptr,&vstr,&vlen,&vlong));
serverAssert(ziplistGet(eptr,&vstr,&vlen,&vlong));
if (vstr == NULL) {
/* Store string representation of long long in buf. */
vlen = ll2string((char*)vbuf,sizeof(vbuf),vlong);
......@@ -700,12 +700,12 @@ unsigned int zzlLength(unsigned char *zl) {
* NULL when there is no next entry. */
void zzlNext(unsigned char *zl, unsigned char **eptr, unsigned char **sptr) {
unsigned char *_eptr, *_sptr;
redisAssert(*eptr != NULL && *sptr != NULL);
serverAssert(*eptr != NULL && *sptr != NULL);
_eptr = ziplistNext(zl,*sptr);
if (_eptr != NULL) {
_sptr = ziplistNext(zl,_eptr);
redisAssert(_sptr != NULL);
serverAssert(_sptr != NULL);
} else {
/* No next entry. */
_sptr = NULL;
......@@ -719,12 +719,12 @@ void zzlNext(unsigned char *zl, unsigned char **eptr, unsigned char **sptr) {
* set to NULL when there is no next entry. */
void zzlPrev(unsigned char *zl, unsigned char **eptr, unsigned char **sptr) {
unsigned char *_eptr, *_sptr;
redisAssert(*eptr != NULL && *sptr != NULL);
serverAssert(*eptr != NULL && *sptr != NULL);
_sptr = ziplistPrev(zl,*eptr);
if (_sptr != NULL) {
_eptr = ziplistPrev(zl,_sptr);
redisAssert(_eptr != NULL);
serverAssert(_eptr != NULL);
} else {
/* No previous entry. */
_eptr = NULL;
......@@ -752,7 +752,7 @@ int zzlIsInRange(unsigned char *zl, zrangespec *range) {
return 0;
p = ziplistIndex(zl,1); /* First score. */
redisAssert(p != NULL);
serverAssert(p != NULL);
score = zzlGetScore(p);
if (!zslValueLteMax(score,range))
return 0;
......@@ -771,7 +771,7 @@ unsigned char *zzlFirstInRange(unsigned char *zl, zrangespec *range) {
while (eptr != NULL) {
sptr = ziplistNext(zl,eptr);
redisAssert(sptr != NULL);
serverAssert(sptr != NULL);
score = zzlGetScore(sptr);
if (zslValueGteMin(score,range)) {
......@@ -799,7 +799,7 @@ unsigned char *zzlLastInRange(unsigned char *zl, zrangespec *range) {
while (eptr != NULL) {
sptr = ziplistNext(zl,eptr);
redisAssert(sptr != NULL);
serverAssert(sptr != NULL);
score = zzlGetScore(sptr);
if (zslValueLteMax(score,range)) {
......@@ -813,7 +813,7 @@ unsigned char *zzlLastInRange(unsigned char *zl, zrangespec *range) {
* When this returns NULL, we know there also is no element. */
sptr = ziplistPrev(zl,eptr);
if (sptr != NULL)
redisAssert((eptr = ziplistPrev(zl,sptr)) != NULL);
serverAssert((eptr = ziplistPrev(zl,sptr)) != NULL);
else
eptr = NULL;
}
......@@ -852,7 +852,7 @@ int zzlIsInLexRange(unsigned char *zl, zlexrangespec *range) {
return 0;
p = ziplistIndex(zl,0); /* First element. */
redisAssert(p != NULL);
serverAssert(p != NULL);
if (!zzlLexValueLteMax(p,range))
return 0;
......@@ -877,7 +877,7 @@ unsigned char *zzlFirstInLexRange(unsigned char *zl, zlexrangespec *range) {
/* Move to next element. */
sptr = ziplistNext(zl,eptr); /* This element score. Skip it. */
redisAssert(sptr != NULL);
serverAssert(sptr != NULL);
eptr = ziplistNext(zl,sptr); /* Next element. */
}
......@@ -904,7 +904,7 @@ unsigned char *zzlLastInLexRange(unsigned char *zl, zlexrangespec *range) {
* When this returns NULL, we know there also is no element. */
sptr = ziplistPrev(zl,eptr);
if (sptr != NULL)
redisAssert((eptr = ziplistPrev(zl,sptr)) != NULL);
serverAssert((eptr = ziplistPrev(zl,sptr)) != NULL);
else
eptr = NULL;
}
......@@ -918,7 +918,7 @@ unsigned char *zzlFind(unsigned char *zl, robj *ele, double *score) {
ele = getDecodedObject(ele);
while (eptr != NULL) {
sptr = ziplistNext(zl,eptr);
redisAssertWithInfo(NULL,ele,sptr != NULL);
serverAssertWithInfo(NULL,ele,sptr != NULL);
if (ziplistCompare(eptr,ele->ptr,sdslen(ele->ptr))) {
/* Matching element, pull out score. */
......@@ -952,7 +952,7 @@ unsigned char *zzlInsertAt(unsigned char *zl, unsigned char *eptr, robj *ele, do
int scorelen;
size_t offset;
redisAssertWithInfo(NULL,ele,sdsEncodedObject(ele));
serverAssertWithInfo(NULL,ele,sdsEncodedObject(ele));
scorelen = d2string(scorebuf,sizeof(scorebuf),score);
if (eptr == NULL) {
zl = ziplistPush(zl,ele->ptr,sdslen(ele->ptr),ZIPLIST_TAIL);
......@@ -964,7 +964,7 @@ unsigned char *zzlInsertAt(unsigned char *zl, unsigned char *eptr, robj *ele, do
eptr = zl+offset;
/* Insert score after the element. */
redisAssertWithInfo(NULL,ele,(sptr = ziplistNext(zl,eptr)) != NULL);
serverAssertWithInfo(NULL,ele,(sptr = ziplistNext(zl,eptr)) != NULL);
zl = ziplistInsert(zl,sptr,(unsigned char*)scorebuf,scorelen);
}
......@@ -980,7 +980,7 @@ unsigned char *zzlInsert(unsigned char *zl, robj *ele, double score) {
ele = getDecodedObject(ele);
while (eptr != NULL) {
sptr = ziplistNext(zl,eptr);
redisAssertWithInfo(NULL,ele,sptr != NULL);
serverAssertWithInfo(NULL,ele,sptr != NULL);
s = zzlGetScore(sptr);
if (s > score) {
......@@ -1112,13 +1112,13 @@ void zsetConvert(robj *zobj, int encoding) {
zs->zsl = zslCreate();
eptr = ziplistIndex(zl,0);
redisAssertWithInfo(NULL,zobj,eptr != NULL);
serverAssertWithInfo(NULL,zobj,eptr != NULL);
sptr = ziplistNext(zl,eptr);
redisAssertWithInfo(NULL,zobj,sptr != NULL);
serverAssertWithInfo(NULL,zobj,sptr != NULL);
while (eptr != NULL) {
score = zzlGetScore(sptr);
redisAssertWithInfo(NULL,zobj,ziplistGet(eptr,&vstr,&vlen,&vlong));
serverAssertWithInfo(NULL,zobj,ziplistGet(eptr,&vstr,&vlen,&vlong));
if (vstr == NULL)
ele = createStringObjectFromLongLong(vlong);
else
......@@ -1126,7 +1126,7 @@ void zsetConvert(robj *zobj, int encoding) {
/* Has incremented refcount since it was just created. */
node = zslInsert(zs->zsl,score,ele);
redisAssertWithInfo(NULL,zobj,dictAdd(zs->dict,ele,&node->score) == DICT_OK);
serverAssertWithInfo(NULL,zobj,dictAdd(zs->dict,ele,&node->score) == DICT_OK);
incrRefCount(ele); /* Added to dictionary. */
zzlNext(zl,&eptr,&sptr);
}
......@@ -1347,7 +1347,7 @@ void zaddGenericCommand(client *c, int flags) {
* delete the key object from the skiplist, since the
* dictionary still has a reference to it. */
if (score != curscore) {
redisAssertWithInfo(c,curobj,zslDelete(zs->zsl,curscore,curobj));
serverAssertWithInfo(c,curobj,zslDelete(zs->zsl,curscore,curobj));
znode = zslInsert(zs->zsl,score,curobj);
incrRefCount(curobj); /* Re-inserted in skiplist. */
dictGetVal(de) = &znode->score; /* Update score ptr. */
......@@ -1358,7 +1358,7 @@ void zaddGenericCommand(client *c, int flags) {
} else if (!xx) {
znode = zslInsert(zs->zsl,score,ele);
incrRefCount(ele); /* Inserted in skiplist. */
redisAssertWithInfo(c,NULL,dictAdd(zs->dict,ele,&znode->score) == DICT_OK);
serverAssertWithInfo(c,NULL,dictAdd(zs->dict,ele,&znode->score) == DICT_OK);
incrRefCount(ele); /* Added to dictionary. */
server.dirty++;
added++;
......@@ -1430,7 +1430,7 @@ void zremCommand(client *c) {
/* Delete from the skiplist */
score = *(double*)dictGetVal(de);
redisAssertWithInfo(c,c->argv[j],zslDelete(zs->zsl,score,c->argv[j]));
serverAssertWithInfo(c,c->argv[j],zslDelete(zs->zsl,score,c->argv[j]));
/* Delete from the hash table */
dictDelete(zs->dict,c->argv[j]);
......@@ -1654,7 +1654,7 @@ void zuiInitIterator(zsetopsrc *op) {
it->zl.eptr = ziplistIndex(it->zl.zl,0);
if (it->zl.eptr != NULL) {
it->zl.sptr = ziplistNext(it->zl.zl,it->zl.eptr);
redisAssert(it->zl.sptr != NULL);
serverAssert(it->zl.sptr != NULL);
}
} else if (op->encoding == OBJ_ENCODING_SKIPLIST) {
it->sl.zs = op->subject->ptr;
......@@ -1762,7 +1762,7 @@ int zuiNext(zsetopsrc *op, zsetopval *val) {
/* No need to check both, but better be explicit. */
if (it->zl.eptr == NULL || it->zl.sptr == NULL)
return 0;
redisAssert(ziplistGet(it->zl.eptr,&val->estr,&val->elen,&val->ell));
serverAssert(ziplistGet(it->zl.eptr,&val->estr,&val->elen,&val->ell));
val->score = zzlGetScore(it->zl.sptr);
/* Move to next element. */
......@@ -2223,12 +2223,12 @@ void zrangeGenericCommand(client *c, int reverse) {
else
eptr = ziplistIndex(zl,2*start);
redisAssertWithInfo(c,zobj,eptr != NULL);
serverAssertWithInfo(c,zobj,eptr != NULL);
sptr = ziplistNext(zl,eptr);
while (rangelen--) {
redisAssertWithInfo(c,zobj,eptr != NULL && sptr != NULL);
redisAssertWithInfo(c,zobj,ziplistGet(eptr,&vstr,&vlen,&vlong));
serverAssertWithInfo(c,zobj,eptr != NULL && sptr != NULL);
serverAssertWithInfo(c,zobj,ziplistGet(eptr,&vstr,&vlen,&vlong));
if (vstr == NULL)
addReplyBulkLongLong(c,vlong);
else
......@@ -2261,7 +2261,7 @@ void zrangeGenericCommand(client *c, int reverse) {
}
while(rangelen--) {
redisAssertWithInfo(c,zobj,ln != NULL);
serverAssertWithInfo(c,zobj,ln != NULL);
ele = ln->obj;
addReplyBulk(c,ele);
if (withscores)
......@@ -2353,7 +2353,7 @@ void genericZrangebyscoreCommand(client *c, int reverse) {
}
/* Get score pointer for the first element. */
redisAssertWithInfo(c,zobj,eptr != NULL);
serverAssertWithInfo(c,zobj,eptr != NULL);
sptr = ziplistNext(zl,eptr);
/* We don't know in advance how many matching elements there are in the
......@@ -2382,7 +2382,7 @@ void genericZrangebyscoreCommand(client *c, int reverse) {
}
/* We know the element exists, so ziplistGet should always succeed */
redisAssertWithInfo(c,zobj,ziplistGet(eptr,&vstr,&vlen,&vlong));
serverAssertWithInfo(c,zobj,ziplistGet(eptr,&vstr,&vlen,&vlong));
rangelen++;
if (vstr == NULL) {
......@@ -2509,7 +2509,7 @@ void zcountCommand(client *c) {
/* First element is in range */
sptr = ziplistNext(zl,eptr);
score = zzlGetScore(sptr);
redisAssertWithInfo(c,zobj,zslValueLteMax(score,&range));
serverAssertWithInfo(c,zobj,zslValueLteMax(score,&range));
/* Iterate over elements in range */
while (eptr) {
......@@ -2589,7 +2589,7 @@ void zlexcountCommand(client *c) {
/* First element is in range */
sptr = ziplistNext(zl,eptr);
redisAssertWithInfo(c,zobj,zzlLexValueLteMax(eptr,&range));
serverAssertWithInfo(c,zobj,zzlLexValueLteMax(eptr,&range));
/* Iterate over elements in range */
while (eptr) {
......@@ -2705,7 +2705,7 @@ void genericZrangebylexCommand(client *c, int reverse) {
}
/* Get score pointer for the first element. */
redisAssertWithInfo(c,zobj,eptr != NULL);
serverAssertWithInfo(c,zobj,eptr != NULL);
sptr = ziplistNext(zl,eptr);
/* We don't know in advance how many matching elements there are in the
......@@ -2733,7 +2733,7 @@ void genericZrangebylexCommand(client *c, int reverse) {
/* We know the element exists, so ziplistGet should always
* succeed. */
redisAssertWithInfo(c,zobj,ziplistGet(eptr,&vstr,&vlen,&vlong));
serverAssertWithInfo(c,zobj,ziplistGet(eptr,&vstr,&vlen,&vlong));
rangelen++;
if (vstr == NULL) {
......@@ -2853,16 +2853,16 @@ void zrankGenericCommand(client *c, int reverse) {
checkType(c,zobj,OBJ_ZSET)) return;
llen = zsetLength(zobj);
redisAssertWithInfo(c,ele,sdsEncodedObject(ele));
serverAssertWithInfo(c,ele,sdsEncodedObject(ele));
if (zobj->encoding == OBJ_ENCODING_ZIPLIST) {
unsigned char *zl = zobj->ptr;
unsigned char *eptr, *sptr;
eptr = ziplistIndex(zl,0);
redisAssertWithInfo(c,zobj,eptr != NULL);
serverAssertWithInfo(c,zobj,eptr != NULL);
sptr = ziplistNext(zl,eptr);
redisAssertWithInfo(c,zobj,sptr != NULL);
serverAssertWithInfo(c,zobj,sptr != NULL);
rank = 1;
while(eptr != NULL) {
......@@ -2891,7 +2891,7 @@ void zrankGenericCommand(client *c, int reverse) {
if (de != NULL) {
score = *(double*)dictGetVal(de);
rank = zslGetRank(zsl,score,ele);
redisAssertWithInfo(c,ele,rank); /* Existing elements always have a rank. */
serverAssertWithInfo(c,ele,rank); /* Existing elements always have a rank. */
if (reverse)
addReplyLongLong(c,llen-rank);
else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment