summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2017-12-04 17:25:34 +0100
committerGitHub <noreply@github.com>2017-12-04 17:25:34 +0100
commite6c3bcf9e072c8c40814577f2421b5d5184b2243 (patch)
tree6912931bce5db19a1f4e2f10737c3ab9ca2b8ac3
parent2869284e44ca64d633a75752981333d5c0520056 (diff)
parentb9491b65d991498bf62f2b5533405e161aee650a (diff)
downloadredis-e6c3bcf9e072c8c40814577f2421b5d5184b2243.tar.gz
Merge pull request #4506 from soloestoy/quicklist-int-problem
Quicklist int problem
-rw-r--r--src/debug.c4
-rw-r--r--src/quicklist.c2
-rw-r--r--src/quicklist.h6
3 files changed, 6 insertions, 6 deletions
diff --git a/src/debug.c b/src/debug.c
index 9e084f9d7..0529e5a85 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -393,13 +393,13 @@ void debugCommand(client *c) {
val = dictGetVal(de);
strenc = strEncoding(val->encoding);
- char extra[128] = {0};
+ char extra[138] = {0};
if (val->encoding == OBJ_ENCODING_QUICKLIST) {
char *nextra = extra;
int remaining = sizeof(extra);
quicklist *ql = val->ptr;
/* Add number of quicklist nodes */
- int used = snprintf(nextra, remaining, " ql_nodes:%u", ql->len);
+ int used = snprintf(nextra, remaining, " ql_nodes:%lu", ql->len);
nextra += used;
remaining -= used;
/* Add average quicklist fill factor */
diff --git a/src/quicklist.c b/src/quicklist.c
index c8b72743c..faa08c65f 100644
--- a/src/quicklist.c
+++ b/src/quicklist.c
@@ -149,7 +149,7 @@ REDIS_STATIC quicklistNode *quicklistCreateNode(void) {
}
/* Return cached quicklist count */
-unsigned int quicklistCount(const quicklist *ql) { return ql->count; }
+unsigned long quicklistCount(const quicklist *ql) { return ql->count; }
/* Free entire quicklist. */
void quicklistRelease(quicklist *quicklist) {
diff --git a/src/quicklist.h b/src/quicklist.h
index 8f3875900..955a22cfa 100644
--- a/src/quicklist.h
+++ b/src/quicklist.h
@@ -64,7 +64,7 @@ typedef struct quicklistLZF {
char compressed[];
} quicklistLZF;
-/* quicklist is a 32 byte struct (on 64-bit systems) describing a quicklist.
+/* quicklist is a 40 byte struct (on 64-bit systems) describing a quicklist.
* 'count' is the number of total entries.
* 'len' is the number of quicklist nodes.
* 'compress' is: -1 if compression disabled, otherwise it's the number
@@ -74,7 +74,7 @@ typedef struct quicklist {
quicklistNode *head;
quicklistNode *tail;
unsigned long count; /* total count of all entries in all ziplists */
- unsigned int len; /* number of quicklistNodes */
+ unsigned long len; /* number of quicklistNodes */
int fill : 16; /* fill factor for individual nodes */
unsigned int compress : 16; /* depth of end nodes not to compress;0=off */
} quicklist;
@@ -154,7 +154,7 @@ int quicklistPopCustom(quicklist *quicklist, int where, unsigned char **data,
void *(*saver)(unsigned char *data, unsigned int sz));
int quicklistPop(quicklist *quicklist, int where, unsigned char **data,
unsigned int *sz, long long *slong);
-unsigned int quicklistCount(const quicklist *ql);
+unsigned long quicklistCount(const quicklist *ql);
int quicklistCompare(unsigned char *p1, unsigned char *p2, int p2_len);
size_t quicklistGetLzf(const quicklistNode *node, void **data);