unsigned int len = *p;
if (len < ZIPMAP_BIGLEN) return len;
- memcpy(&len,p,sizeof(unsigned int));
+ memcpy(&len,p+1,sizeof(unsigned int));
return len;
}
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;