summaryrefslogtreecommitdiff
path: root/src/t_set.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2010-08-26 18:47:03 +0200
committerantirez <antirez@gmail.com>2010-08-26 18:47:03 +0200
commitec7e138926b7b587adc247e8c64da6d3b1706434 (patch)
treec560ecf8b19225b036ff3a2791956474e9775856 /src/t_set.c
parent23c64fe50ddbc01f825ebe64f1a8b5f14c584327 (diff)
downloadredis-ec7e138926b7b587adc247e8c64da6d3b1706434.tar.gz
test for intset integer encodability test and some small refactoring
Diffstat (limited to 'src/t_set.c')
-rw-r--r--src/t_set.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/t_set.c b/src/t_set.c
index 97fc5bf45..68e132278 100644
--- a/src/t_set.c
+++ b/src/t_set.c
@@ -8,7 +8,7 @@
* an integer-encodable value, an intset will be returned. Otherwise a regular
* hash table. */
robj *setTypeCreate(robj *value) {
- if (getLongLongFromObject(value,NULL) == REDIS_OK)
+ if (isObjectRepresentableAsLongLong(value,NULL) == REDIS_OK)
return createIntsetObject();
return createSetObject();
}
@@ -21,7 +21,7 @@ int setTypeAdd(robj *subject, robj *value) {
return 1;
}
} else if (subject->encoding == REDIS_ENCODING_INTSET) {
- if (getLongLongFromObject(value,&llval) == REDIS_OK) {
+ if (isObjectRepresentableAsLongLong(value,&llval) == REDIS_OK) {
uint8_t success = 0;
subject->ptr = intsetAdd(subject->ptr,llval,&success);
if (success) {
@@ -55,7 +55,7 @@ int setTypeRemove(robj *subject, robj *value) {
return 1;
}
} else if (subject->encoding == REDIS_ENCODING_INTSET) {
- if (getLongLongFromObject(value,&llval) == REDIS_OK) {
+ if (isObjectRepresentableAsLongLong(value,&llval) == REDIS_OK) {
uint8_t success;
subject->ptr = intsetRemove(subject->ptr,llval,&success);
if (success) return 1;
@@ -71,7 +71,7 @@ int setTypeIsMember(robj *subject, robj *value) {
if (subject->encoding == REDIS_ENCODING_HT) {
return dictFind((dict*)subject->ptr,value) != NULL;
} else if (subject->encoding == REDIS_ENCODING_INTSET) {
- if (getLongLongFromObject(value,&llval) == REDIS_OK) {
+ if (isObjectRepresentableAsLongLong(value,&llval) == REDIS_OK) {
return intsetFind((intset*)subject->ptr,llval);
}
} else {