Geo: remove static declarations.

Stack traces produced by Redis on crash are the most useful tool we
have to fix non easily reproducible crashes, or even easily reproducible
ones where the user just posts a bug report and does not collaborate
furhter.

By declaring functions "static" they no longer show up in the stack
trace.
This commit is contained in:
antirez 2015-06-29 15:57:17 +02:00
parent f108c687ad
commit 083acbebc8

View File

@ -82,7 +82,7 @@ void geoArrayFree(geoArray *ga) {
/* ==================================================================== /* ====================================================================
* Helpers * Helpers
* ==================================================================== */ * ==================================================================== */
static inline int decodeGeohash(double bits, double *xy) { int decodeGeohash(double bits, double *xy) {
GeoHashBits hash = { .bits = (uint64_t)bits, .step = GEO_STEP_MAX }; GeoHashBits hash = { .bits = (uint64_t)bits, .step = GEO_STEP_MAX };
return geohashDecodeToLongLatWGS84(hash, xy); return geohashDecodeToLongLatWGS84(hash, xy);
} }
@ -90,7 +90,7 @@ static inline int decodeGeohash(double bits, double *xy) {
/* Input Argument Helper */ /* Input Argument Helper */
/* Take a pointer to the latitude arg then use the next arg for longitude. /* Take a pointer to the latitude arg then use the next arg for longitude.
* On parse error REDIS_ERR is returned, otherwise REDIS_OK. */ * On parse error REDIS_ERR is returned, otherwise REDIS_OK. */
static inline int extractLongLatOrReply(redisClient *c, robj **argv, int extractLongLatOrReply(redisClient *c, robj **argv,
double *xy) { double *xy) {
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
if (getDoubleFromObjectOrReply(c, argv[i], xy + i, NULL) != if (getDoubleFromObjectOrReply(c, argv[i], xy + i, NULL) !=
@ -104,7 +104,7 @@ static inline int extractLongLatOrReply(redisClient *c, robj **argv,
/* Input Argument Helper */ /* Input Argument Helper */
/* Decode lat/long from a zset member's score. /* Decode lat/long from a zset member's score.
* Returns REDIS_OK on successful decoding, otherwise REDIS_ERR is returned. */ * Returns REDIS_OK on successful decoding, otherwise REDIS_ERR is returned. */
static int longLatFromMember(robj *zobj, robj *member, double *xy) { int longLatFromMember(robj *zobj, robj *member, double *xy) {
double score = 0; double score = 0;
if (zsetScore(zobj, member, &score) == REDIS_ERR) return REDIS_ERR; if (zsetScore(zobj, member, &score) == REDIS_ERR) return REDIS_ERR;
@ -143,7 +143,7 @@ double extractUnitOrReply(redisClient *c, robj *unit) {
* to use in order to convert meters to the unit. * to use in order to convert meters to the unit.
* *
* On error a value less than zero is returned. */ * On error a value less than zero is returned. */
static double extractDistanceOrReply(redisClient *c, robj **argv, double extractDistanceOrReply(redisClient *c, robj **argv,
double *conversion) { double *conversion) {
double distance; double distance;
if (getDoubleFromObjectOrReply(c, argv[0], &distance, if (getDoubleFromObjectOrReply(c, argv[0], &distance,
@ -163,7 +163,7 @@ static double extractDistanceOrReply(redisClient *c, robj **argv,
* than "5.2144992818115 meters away." We provide 4 digits after the dot * than "5.2144992818115 meters away." We provide 4 digits after the dot
* so that the returned value is decently accurate even when the unit is * so that the returned value is decently accurate even when the unit is
* the kilometer. */ * the kilometer. */
static inline void addReplyDoubleDistance(redisClient *c, double d) { inline void addReplyDoubleDistance(redisClient *c, double d) {
char dbuf[128]; char dbuf[128];
int dlen = snprintf(dbuf, sizeof(dbuf), "%.4f", d); int dlen = snprintf(dbuf, sizeof(dbuf), "%.4f", d);
addReplyBulkCBuffer(c, dbuf, dlen); addReplyBulkCBuffer(c, dbuf, dlen);
@ -414,7 +414,7 @@ void geoaddCommand(redisClient *c) {
/* GEORADIUS key x y radius unit [WITHDIST] [WITHHASH] [WITHCOORD] [ASC|DESC] /* GEORADIUS key x y radius unit [WITHDIST] [WITHHASH] [WITHCOORD] [ASC|DESC]
* [COUNT count] * [COUNT count]
* GEORADIUSBYMEMBER key member radius unit ... options ... */ * GEORADIUSBYMEMBER key member radius unit ... options ... */
static void georadiusGeneric(redisClient *c, int type) { void georadiusGeneric(redisClient *c, int type) {
robj *key = c->argv[1]; robj *key = c->argv[1];
/* Look up the requested zset */ /* Look up the requested zset */