Lazyfree: Convert Sets to use plains SDS (several commits squashed).

This commit is contained in:
antirez
2015-07-31 18:01:23 +02:00
parent 4ff3c17a20
commit 86d48efbfd
9 changed files with 183 additions and 163 deletions

View File

@ -364,13 +364,17 @@ int checkType(client *c, robj *o, int type) {
return 0;
}
int isSdsRepresentableAsLongLong(sds s, long long *llval) {
return string2ll(s,sdslen(s),llval) ? C_OK : C_ERR;
}
int isObjectRepresentableAsLongLong(robj *o, long long *llval) {
serverAssertWithInfo(NULL,o,o->type == OBJ_STRING);
if (o->encoding == OBJ_ENCODING_INT) {
if (llval) *llval = (long) o->ptr;
return C_OK;
} else {
return string2ll(o->ptr,sdslen(o->ptr),llval) ? C_OK : C_ERR;
return isSdsRepresentableAsLongLong(o->ptr,llval);
}
}