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

Function parseScanCursorOrReply

src/db.cpp:1130–1143  ·  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

1128 * returns C_OK. Otherwise return C_ERR and send an error to the
1129 * client. */
1130int parseScanCursorOrReply(client *c, robj *o, unsigned long *cursor) {
1131 char *eptr;
1132
1133 /* Use strtoul() because we need an *unsigned* long, so
1134 * getLongLongFromObject() does not cover the whole cursor space. */
1135 errno = 0;
1136 *cursor = strtoul(szFromObj(o), &eptr, 10);
1137 if (isspace(((char*)ptrFromObj(o))[0]) || eptr[0] != '\0' || errno == ERANGE)
1138 {
1139 addReplyError(c, "invalid cursor");
1140 return C_ERR;
1141 }
1142 return C_OK;
1143}
1144
1145
1146static bool filterKey(robj_roptr kobj, sds pat, int patlen)

Callers 4

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

Calls 3

szFromObjFunction · 0.85
ptrFromObjFunction · 0.85
addReplyErrorFunction · 0.85

Tested by

no test coverage detected