summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorripcurld00d <boazyko1@gmail.com>2014-04-13 21:09:54 +0300
committerantirez <antirez@gmail.com>2014-08-07 17:11:19 +0200
commit9b4efe6cf4e165bac8031a26541ab04ff6d31402 (patch)
tree7eca0655c29fa2f2e99325a09104660ce9f1f5ab
parentc49378fe3e6f8900e753ff60a1b1f59e2e2c8755 (diff)
downloadredis-9b4efe6cf4e165bac8031a26541ab04ff6d31402.tar.gz
redis-check-dump: use names instead of magic nums
Use constants to avoid magic numbers in `types`, which is an array that stores the names of `REDIS` types. Closes #1681
-rw-r--r--src/redis-check-dump.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/redis-check-dump.c b/src/redis-check-dump.c
index a4f103fdd..185cd243c 100644
--- a/src/redis-check-dump.c
+++ b/src/redis-check-dump.c
@@ -138,8 +138,10 @@ typedef struct {
* at runtime to avoid strange compiler optimizations. */
static double R_Zero, R_PosInf, R_NegInf, R_Nan;
+#define MAX_TYPES_NUM 256
+#define MAX_TYPE_NAME_LEN 16
/* store string types for output */
-static char types[256][16];
+static char types[MAX_TYPES_NUM][MAX_TYPE_NAME_LEN];
/* Return true if 't' is a valid object type. */
int checkType(unsigned char t) {