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 ... */
| 1792 | * [COUNT count] [STORE key] [STOREDIST key] |
| 1793 | * GEORADIUSBYMEMBER key member radius unit ... options ... */ |
| 1794 | int georadiusGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result) { |
| 1795 | int i, num, *keys; |
| 1796 | UNUSED(cmd); |
| 1797 | |
| 1798 | /* Check for the presence of the stored key in the command */ |
| 1799 | int stored_key = -1; |
| 1800 | for (i = 5; i < argc; i++) { |
| 1801 | char *arg = argv[i]->ptr; |
| 1802 | /* For the case when user specifies both "store" and "storedist" options, the |
| 1803 | * second key specified would override the first key. This behavior is kept |
| 1804 | * the same as in georadiusCommand method. |
| 1805 | */ |
| 1806 | if ((!strcasecmp(arg, "store") || !strcasecmp(arg, "storedist")) && ((i+1) < argc)) { |
| 1807 | stored_key = i+1; |
| 1808 | i++; |
| 1809 | } |
| 1810 | } |
| 1811 | num = 1 + (stored_key == -1 ? 0 : 1); |
| 1812 | |
| 1813 | /* Keys in the command come from two places: |
| 1814 | * argv[1] = key, |
| 1815 | * argv[5...n] = stored key if present |
| 1816 | */ |
| 1817 | keys = getKeysPrepareResult(result, num); |
| 1818 | |
| 1819 | /* Add all key positions to keys[] */ |
| 1820 | keys[0] = 1; |
| 1821 | if(num > 1) { |
| 1822 | keys[1] = stored_key; |
| 1823 | } |
| 1824 | result->numkeys = num; |
| 1825 | return num; |
| 1826 | } |
| 1827 | |
| 1828 | /* LCS ... [KEYS <key1> <key2>] ... */ |
| 1829 | int lcsGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResult *result) { |
nothing calls this directly
no test coverage detected