summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Parker <michael.g.parker@gmail.com>2012-07-25 23:51:22 -0700
committerantirez <antirez@gmail.com>2012-07-31 11:48:00 +0200
commitf1d187bb3ece6b4b13a6b74e8e5ccab9fe9d40ff (patch)
treea337c34b70a6122f5ad56e6f66b4d737f240a016
parented2a691aba0cea2e789290d8d388cc8091703577 (diff)
downloadredis-f1d187bb3ece6b4b13a6b74e8e5ccab9fe9d40ff.tar.gz
Use correct variable name for value to convert.
Note by @antirez: this code was never compiled because utils.c lacked the float.h include, so we never noticed this variable was mispelled in the past. This should provide a noticeable speed boost when saving certain types of databases with many sorted sets inside.
-rw-r--r--src/util.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/util.c b/src/util.c
index bcdafc639..e3224f501 100644
--- a/src/util.c
+++ b/src/util.c
@@ -7,6 +7,7 @@
#include <math.h>
#include <unistd.h>
#include <sys/time.h>
+#include <float.h>
#include "util.h"
@@ -319,7 +320,7 @@ int d2string(char *buf, size_t len, double value) {
* integer printing function that is much faster. */
double min = -4503599627370495; /* (2^52)-1 */
double max = 4503599627370496; /* -(2^52) */
- if (val > min && val < max && value == ((double)((long long)value)))
+ if (value > min && value < max && value == ((double)((long long)value)))
len = ll2string(buf,len,(long long)value);
else
#endif