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

Function zslParseLexRange

src/t_zset.cpp:611–625  ·  view source on GitHub ↗

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. */

Source from the content-addressed store, hash-verified

609 * When OK is returned the structure must be freed with zslFreeLexRange(),
610 * otherwise no release is needed. */
611int 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

Callers 4

zremrangeGenericCommandFunction · 0.85
zlexcountCommandFunction · 0.85
zrangeGenericCommandFunction · 0.85
zsetInitLexRangeFunction · 0.85

Calls 2

zslParseLexRangeItemFunction · 0.85
zslFreeLexRangeFunction · 0.85

Tested by

no test coverage detected