diff options
author | antirez <antirez@gmail.com> | 2010-03-08 21:33:07 +0100 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2010-03-08 21:33:07 +0100 |
commit | b1befe6a8e4fbec81e721d1a5a0871f88411a1c9 (patch) | |
tree | b58f5b0ac8f2c822310652bffd022d9478e69783 /zipmap.c | |
parent | cbba7dd7c90f7b5b845d1dea86390572e5b4fa2c (diff) | |
download | redis-b1befe6a8e4fbec81e721d1a5a0871f88411a1c9.tar.gz |
Hashes saving / fixes
Diffstat (limited to 'zipmap.c')
-rw-r--r-- | zipmap.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -363,6 +363,15 @@ int zipmapExists(unsigned char *zm, unsigned char *key, unsigned int klen) { return zipmapLookupRaw(zm,key,klen,NULL,NULL,NULL) != NULL; } +/* Return the number of entries inside a zipmap */ +unsigned int zipmapLen(unsigned char *zm) { + unsigned char *p = zipmapRewind(zm); + unsigned int len = 0; + + while((p = zipmapNext(p,NULL,NULL,NULL,NULL)) != NULL) len++; + return len; +} + void zipmapRepr(unsigned char *p) { unsigned int l; |