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

Function zzlFind

src/t_zset.cpp:1004–1021  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1002}
1003
1004unsigned char *zzlFind(unsigned char *zl, sds ele, double *score) {
1005 unsigned char *eptr = ziplistIndex(zl,0), *sptr;
1006
1007 while (eptr != NULL) {
1008 sptr = ziplistNext(zl,eptr);
1009 serverAssert(sptr != NULL);
1010
1011 if (ziplistCompare(eptr,(unsigned char*)ele,sdslen(ele))) {
1012 /* Matching element, pull out score. */
1013 if (score != NULL) *score = zzlGetScore(sptr);
1014 return eptr;
1015 }
1016
1017 /* Move to next element. */
1018 eptr = ziplistNext(zl,sptr);
1019 }
1020 return NULL;
1021}
1022
1023/* Delete (element,score) pair from ziplist. Use local copy of eptr because we
1024 * don't want to modify the one given as argument. */

Callers 4

zsetScoreFunction · 0.85
zsetAddFunction · 0.85
zsetDelFunction · 0.85
zuiFindFunction · 0.85

Calls 5

ziplistIndexFunction · 0.85
ziplistNextFunction · 0.85
ziplistCompareFunction · 0.85
sdslenFunction · 0.85
zzlGetScoreFunction · 0.85

Tested by

no test coverage detected