Returns if there is a part of the zset is in the lex range. */
| 648 | |
| 649 | /* Returns if there is a part of the zset is in the lex range. */ |
| 650 | int zslIsInLexRange(zskiplist *zsl, zlexrangespec *range) { |
| 651 | zskiplistNode *x; |
| 652 | |
| 653 | /* Test for ranges that will always be empty. */ |
| 654 | int cmp = sdscmplex(range->min,range->max); |
| 655 | if (cmp > 0 || (cmp == 0 && (range->minex || range->maxex))) |
| 656 | return 0; |
| 657 | x = zsl->tail; |
| 658 | if (x == NULL || !zslLexValueGteMin(x->ele,range)) |
| 659 | return 0; |
| 660 | x = zsl->header->level(0)->forward; |
| 661 | if (x == NULL || !zslLexValueLteMax(x->ele,range)) |
| 662 | return 0; |
| 663 | return 1; |
| 664 | } |
| 665 | |
| 666 | /* Find the first node that is contained in the specified lex range. |
| 667 | * Returns NULL when no element is contained in the range. */ |
no test coverage detected