Helper function to extract keys from following commands: * GEORADIUS key x y radius unit [WITHDIST] [WITHHASH] [WITHCOORD] [ASC|DESC] * [COUNT count] [STORE key] [STOREDIST key] * GEORADIUSBYMEMBER key member radius unit ... options ... */
| 2341 | * [COUNT count] [STORE key] [STOREDIST key] |
| 2342 | * GEORADIUSBYMEMBER key member radius unit ... options ... */ |
| 2343 | int georadiusGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result) { |
| 2344 | int i, num, *keys; |
| 2345 | UNUSED(cmd); |
| 2346 | |
| 2347 | /* Check for the presence of the stored key in the command */ |
| 2348 | int stored_key = -1; |
| 2349 | for (i = 5; i < argc; i++) { |
| 2350 | char *arg = szFromObj(argv[i]); |
| 2351 | /* For the case when user specifies both "store" and "storedist" options, the |
| 2352 | * second key specified would override the first key. This behavior is kept |
| 2353 | * the same as in georadiusCommand method. |
| 2354 | */ |
| 2355 | if ((!strcasecmp(arg, "store") || !strcasecmp(arg, "storedist")) && ((i+1) < argc)) { |
| 2356 | stored_key = i+1; |
| 2357 | i++; |
| 2358 | } |
| 2359 | } |
| 2360 | num = 1 + (stored_key == -1 ? 0 : 1); |
| 2361 | |
| 2362 | /* Keys in the command come from two places: |
| 2363 | * argv[1] = key, |
| 2364 | * argv[5...n] = stored key if present |
| 2365 | */ |
| 2366 | keys = getKeysPrepareResult(result, num); |
| 2367 | |
| 2368 | /* Add all key positions to keys[] */ |
| 2369 | keys[0] = 1; |
| 2370 | if(num > 1) { |
| 2371 | keys[1] = stored_key; |
| 2372 | } |
| 2373 | result->numkeys = num; |
| 2374 | return num; |
| 2375 | } |
| 2376 | |
| 2377 | /* LCS ... [KEYS <key1> <key2>] ... */ |
| 2378 | int lcsGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result) { |
nothing calls this directly
no test coverage detected