summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2015-06-29 09:16:27 +0200
committerantirez <antirez@gmail.com>2015-06-29 09:16:27 +0200
commit7d59e0a8c3fb42bcf0e362a41f8abd01c1509429 (patch)
treef07bcf4edd0607b8a4079b998a993a9dd0cac572
parenta3b07b1718368447f76788dd8febe01635a11f69 (diff)
downloadredis-7d59e0a8c3fb42bcf0e362a41f8abd01c1509429.tar.gz
Geo: commands top comment as in other Redis code.
-rw-r--r--src/geo.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/geo.c b/src/geo.c
index c48646635..888bf8745 100644
--- a/src/geo.c
+++ b/src/geo.c
@@ -341,11 +341,9 @@ static int sort_gp_desc(const void *a, const void *b) {
/* ====================================================================
* Commands
* ==================================================================== */
-void geoAddCommand(redisClient *c) {
- /* args 0-4: [cmd, key, lng, lat, val]; optional 5-6: [radius, units]
- * - OR -
- * args 0-N: [cmd, key, lng, lat, val, lng2, lat2, val2, ...] */
+/* GEOADD key long lat name [long2 lat2 name2 ... longN latN nameN] */
+void geoAddCommand(redisClient *c) {
/* Prepare for the three different forms of the add command. */
double radius_meters = 0;
if (c->argc == 7) {
@@ -568,18 +566,17 @@ static void geoRadiusGeneric(redisClient *c, int type) {
geoArrayFree(ga);
}
+/* GEORADIUS wrapper function. */
void geoRadiusCommand(redisClient *c) {
- /* args 0-5: ["georadius", key, long, lat, radius, units];
- * optionals: [withdist, withcoords, asc|desc] */
geoRadiusGeneric(c, RADIUS_COORDS);
}
+/* GEORADIUSBYMEMBER wrapper function. */
void geoRadiusByMemberCommand(redisClient *c) {
- /* args 0-4: ["georadius", key, compare-against-member, radius, units];
- * optionals: [withdist, withcoords, asc|desc] */
geoRadiusGeneric(c, RADIUS_MEMBER);
}
+/* GEODECODE long lat */
void geoDecodeCommand(redisClient *c) {
GeoHashBits geohash;
if (getLongLongFromObjectOrReply(c, c->argv[1], (long long *)&geohash.bits,
@@ -612,10 +609,8 @@ void geoDecodeCommand(redisClient *c) {
addReplyDouble(c, lat);
}
+/* GEOENCODE long lat [radius unit] */
void geoEncodeCommand(redisClient *c) {
- /* args 0-2: ["geoencode", long, lat];
- * optionals: [radius, units] */
-
double radius_meters = 0;
if (c->argc >= 5) {
if ((radius_meters = extractDistanceOrReply(c, c->argv + 3, NULL)) < 0)
@@ -628,7 +623,7 @@ void geoEncodeCommand(redisClient *c) {
double xy[2];
if (extractLongLatOrReply(c, c->argv + 1, xy) == REDIS_ERR) return;
- /* Encode lat/long into our geohash */
+ /* Encode long/lat into our geohash */
GeoHashBits geohash;
uint8_t step = geohashEstimateStepsByRadius(radius_meters,0);
geohashEncodeWGS84(xy[0], xy[1], step, &geohash);