Returns if there is a part of the zset is in range. */
| 310 | |
| 311 | /* Returns if there is a part of the zset is in range. */ |
| 312 | int zslIsInRange(zskiplist *zsl, zrangespec *range) { |
| 313 | zskiplistNode *x; |
| 314 | |
| 315 | /* Test for ranges that will always be empty. */ |
| 316 | if (range->min > range->max || |
| 317 | (range->min == range->max && (range->minex || range->maxex))) |
| 318 | return 0; |
| 319 | x = zsl->tail; |
| 320 | if (x == NULL || !zslValueGteMin(x->score,range)) |
| 321 | return 0; |
| 322 | x = zsl->header->level(0)->forward; |
| 323 | if (x == NULL || !zslValueLteMax(x->score,range)) |
| 324 | return 0; |
| 325 | return 1; |
| 326 | } |
| 327 | |
| 328 | /* Find the first node that is contained in the specified range. |
| 329 | * Returns NULL when no element is contained in the range. */ |
no test coverage detected