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

Function zipmapGet

src/zipmap.c:338–346  ·  view source on GitHub ↗

Search a key and retrieve the pointer and len of the associated value. * If the key is found the function returns 1, otherwise 0. */

Source from the content-addressed store, hash-verified

336/* Search a key and retrieve the pointer and len of the associated value.
337 * If the key is found the function returns 1, otherwise 0. */
338int zipmapGet(unsigned char *zm, unsigned char *key, unsigned int klen, unsigned char **value, unsigned int *vlen) {
339 unsigned char *p;
340
341 if ((p = zipmapLookupRaw(zm,key,klen,NULL)) == NULL) return 0;
342 p += zipmapRawKeyLength(p);
343 *vlen = zipmapDecodeLength(p);
344 *value = p + ZIPMAP_LEN_BYTES(*vlen) + 1;
345 return 1;
346}
347
348/* Return 1 if the key exists, otherwise 0 is returned. */
349int zipmapExists(unsigned char *zm, unsigned char *key, unsigned int klen) {

Callers 1

zipmapTestFunction · 0.85

Calls 3

zipmapLookupRawFunction · 0.85
zipmapRawKeyLengthFunction · 0.85
zipmapDecodeLengthFunction · 0.85

Tested by

no test coverage detected