Return the number of entries inside a zipmap */
| 352 | |
| 353 | /* Return the number of entries inside a zipmap */ |
| 354 | unsigned int zipmapLen(unsigned char *zm) { |
| 355 | unsigned int len = 0; |
| 356 | if (zm[0] < ZIPMAP_BIGLEN) { |
| 357 | len = zm[0]; |
| 358 | } else { |
| 359 | unsigned char *p = zipmapRewind(zm); |
| 360 | while((p = zipmapNext(p,NULL,NULL,NULL,NULL)) != NULL) len++; |
| 361 | |
| 362 | /* Re-store length if small enough */ |
| 363 | if (len < ZIPMAP_BIGLEN) zm[0] = len; |
| 364 | } |
| 365 | return len; |
| 366 | } |
| 367 | |
| 368 | /* Return the raw size in bytes of a zipmap, so that we can serialize |
| 369 | * the zipmap on disk (or everywhere is needed) just writing the returned |
nothing calls this directly
no test coverage detected