| 1002 | } |
| 1003 | |
| 1004 | unsigned 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. */ |
no test coverage detected