MCPcopy Create free account
hub / github.com/F-Stack/f-stack / parseScanCursorOrReply

Function parseScanCursorOrReply

app/redis-6.2.6/src/db.c:811–824  ·  view source on GitHub ↗

Try to parse a SCAN cursor stored at object 'o': * if the cursor is valid, store it as unsigned integer into *cursor and * returns C_OK. Otherwise return C_ERR and send an error to the * client. */

Source from the content-addressed store, hash-verified

809 * returns C_OK. Otherwise return C_ERR and send an error to the
810 * client. */
811int parseScanCursorOrReply(client *c, robj *o, unsigned long *cursor) {
812 char *eptr;
813
814 /* Use strtoul() because we need an *unsigned* long, so
815 * getLongLongFromObject() does not cover the whole cursor space. */
816 errno = 0;
817 *cursor = strtoul(o->ptr, &eptr, 10);
818 if (isspace(((char*)o->ptr)[0]) || eptr[0] != '\0' || errno == ERANGE)
819 {
820 addReplyError(c, "invalid cursor");
821 return C_ERR;
822 }
823 return C_OK;
824}
825
826/* This command implements SCAN, HSCAN and SSCAN commands.
827 * If object 'o' is passed, then it must be a Hash, Set or Zset object, otherwise

Callers 4

hscanCommandFunction · 0.85
scanCommandFunction · 0.85
sscanCommandFunction · 0.85
zscanCommandFunction · 0.85

Calls 3

strtoulFunction · 0.85
isspaceFunction · 0.85
addReplyErrorFunction · 0.85

Tested by

no test coverage detected