Populate the lex rangespec according to the objects min and max. * * Return C_OK on success. On error C_ERR is returned. * When OK is returned the structure must be freed with zslFreeLexRange(), * otherwise no release is needed. */
| 609 | * When OK is returned the structure must be freed with zslFreeLexRange(), |
| 610 | * otherwise no release is needed. */ |
| 611 | int zslParseLexRange(robj *min, robj *max, zlexrangespec *spec) { |
| 612 | /* The range can't be valid if objects are integer encoded. |
| 613 | * Every item must start with ( or [. */ |
| 614 | if (min->encoding == OBJ_ENCODING_INT || |
| 615 | max->encoding == OBJ_ENCODING_INT) return C_ERR; |
| 616 | |
| 617 | spec->min = spec->max = NULL; |
| 618 | if (zslParseLexRangeItem(min, &spec->min, &spec->minex) == C_ERR || |
| 619 | zslParseLexRangeItem(max, &spec->max, &spec->maxex) == C_ERR) { |
| 620 | zslFreeLexRange(spec); |
| 621 | return C_ERR; |
| 622 | } else { |
| 623 | return C_OK; |
| 624 | } |
| 625 | } |
| 626 | |
| 627 | /* This is just a wrapper to sdscmp() that is able to |
| 628 | * handle shared.minstring and shared.maxstring as the equivalent of |
no test coverage detected