]> git.saurik.com Git - redis.git/commitdiff
dict.c: added macros in dict.h to set signed and unsigned 64 bit values directly...
authorantirez <antirez@gmail.com>
Tue, 8 Nov 2011 18:41:29 +0000 (19:41 +0100)
committerantirez <antirez@gmail.com>
Tue, 8 Nov 2011 18:41:29 +0000 (19:41 +0100)
src/dict.c
src/dict.h

index 11962f7c4579622f62b3e3d2eaca8c1f951b31fb..a573bcd6e3575477f1e58c67811b46122972de88 100644 (file)
@@ -274,7 +274,7 @@ int dictAdd(dict *d, void *key, void *val)
  * mainly in order to store non-pointers inside the hash value, example:
  *
  * entry = dictAddRaw(dict,mykey);
- * if (entry != NULL) dictSetValSignedInteger(entry,1000);
+ * if (entry != NULL) dictSetSignedIntegerVal(entry,1000);
  *
  * Return values:
  *
index af485e2cdabc9dd2f96f6677e4721be764d6cae3..b907a91f43ab3a4112b662b623c5c5506132ce8c 100644 (file)
@@ -105,6 +105,12 @@ typedef struct dictIterator {
         entry->v.val = (_val_); \
 } while(0)
 
+#define dictSetSignedIntegerVal(d, entry, _val_) \
+    do { entry->v.i64 = _val_; } while(0)
+
+#define dictSetUnsignedIntegerVal(d, entry, _val_) \
+    do { entry->v.u64 = _val_; } while(0)
+
 #define dictFreeKey(d, entry) \
     if ((d)->type->keyDestructor) \
         (d)->type->keyDestructor((d)->privdata, (entry)->key)