summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author唐权 <tangquanawj@gmail.com>2019-05-08 12:53:56 +0800
committerGitHub <noreply@github.com>2019-05-08 12:53:56 +0800
commit842dd85b264f7d77a12273f8b2e7700ce99dd610 (patch)
tree52d34183d70c98b88ef6784e7518751d424f9391
parentf674e83215af5f15096bf53a27de6c4ccf21faae (diff)
downloadredis-842dd85b264f7d77a12273f8b2e7700ce99dd610.tar.gz
Update ziplist.c
Hi, @antirez In the code, to get the size of ziplist, "unsigned int bytes = ZIPLIST_HEADER_SIZE+1;" is correct, but why not make it more readable and easy to understand
-rw-r--r--src/ziplist.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/ziplist.c b/src/ziplist.c
index 1579d1109..ef40d6aa2 100644
--- a/src/ziplist.c
+++ b/src/ziplist.c
@@ -576,7 +576,7 @@ void zipEntry(unsigned char *p, zlentry *e) {
/* Create a new empty ziplist. */
unsigned char *ziplistNew(void) {
- unsigned int bytes = ZIPLIST_HEADER_SIZE+1;
+ unsigned int bytes = ZIPLIST_HEADER_SIZE+ZIPLIST_END_SIZE;
unsigned char *zl = zmalloc(bytes);
ZIPLIST_BYTES(zl) = intrev32ifbe(bytes);
ZIPLIST_TAIL_OFFSET(zl) = intrev32ifbe(ZIPLIST_HEADER_SIZE);