diff --git a/src/dict.c b/src/dict.c index 11962f7c..a573bcd6 100644 --- a/src/dict.c +++ b/src/dict.c @@ -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: * diff --git a/src/dict.h b/src/dict.h index af485e2c..b907a91f 100644 --- a/src/dict.h +++ b/src/dict.h @@ -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)