summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2014-06-06 15:32:21 +0200
committerantirez <antirez@gmail.com>2014-06-06 15:32:21 +0200
commitfe85d0600aa3e2368dacd4f12311ffba16ae0209 (patch)
treeeaa99c786ff997b88505df398da5ed63840e4ea3
parenta2403227c7b164e546e53bf329c70caaadef2c14 (diff)
downloadredis-fe85d0600aa3e2368dacd4f12311ffba16ae0209.tar.gz
Add double field in dict.c entry value union.
-rw-r--r--src/dict.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/dict.h b/src/dict.h
index 13f70b679..905330f5d 100644
--- a/src/dict.h
+++ b/src/dict.h
@@ -50,6 +50,7 @@ typedef struct dictEntry {
void *val;
uint64_t u64;
int64_t s64;
+ double d;
} v;
struct dictEntry *next;
} dictEntry;
@@ -114,6 +115,9 @@ typedef void (dictScanFunction)(void *privdata, const dictEntry *de);
#define dictSetUnsignedIntegerVal(entry, _val_) \
do { entry->v.u64 = _val_; } while(0)
+#define dictSetDoubleVal(entry, _val_) \
+ do { entry->v.d = _val_; } while(0)
+
#define dictFreeKey(d, entry) \
if ((d)->type->keyDestructor) \
(d)->type->keyDestructor((d)->privdata, (entry)->key)
@@ -135,6 +139,7 @@ typedef void (dictScanFunction)(void *privdata, const dictEntry *de);
#define dictGetVal(he) ((he)->v.val)
#define dictGetSignedIntegerVal(he) ((he)->v.s64)
#define dictGetUnsignedIntegerVal(he) ((he)->v.u64)
+#define dictGetDoubleVal(he) ((he)->v.d)
#define dictSlots(d) ((d)->ht[0].size+(d)->ht[1].size)
#define dictSize(d) ((d)->ht[0].used+(d)->ht[1].used)
#define dictIsRehashing(ht) ((ht)->rehashidx != -1)