MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / zipmapRepr

Function zipmapRepr

src/zipmap.c:445–476  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

443
444#ifdef REDIS_TEST
445static void zipmapRepr(unsigned char *p) {
446 unsigned int l;
447
448 printf("{status %u}",*p++);
449 while(1) {
450 if (p[0] == ZIPMAP_END) {
451 printf("{end}");
452 break;
453 } else {
454 unsigned char e;
455
456 l = zipmapDecodeLength(p);
457 printf("{key %u}",l);
458 p += zipmapEncodeLength(NULL,l);
459 if (l != 0 && fwrite(p,l,1,stdout) == 0) perror("fwrite");
460 p += l;
461
462 l = zipmapDecodeLength(p);
463 printf("{value %u}",l);
464 p += zipmapEncodeLength(NULL,l);
465 e = *p++;
466 if (l != 0 && fwrite(p,l,1,stdout) == 0) perror("fwrite");
467 p += l+e;
468 if (e) {
469 printf("[");
470 while(e--) printf(".");
471 printf("]");
472 }
473 }
474 }
475 printf("\n");
476}
477
478#define UNUSED(x) (void)(x)
479int zipmapTest(int argc, char *argv[], int accurate) {

Callers 1

zipmapTestFunction · 0.85

Calls 2

zipmapDecodeLengthFunction · 0.85
zipmapEncodeLengthFunction · 0.85

Tested by

no test coverage detected