diff options
author | 唐权 <tangquanawj@gmail.com> | 2019-05-08 12:53:56 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-08 12:53:56 +0800 |
commit | 842dd85b264f7d77a12273f8b2e7700ce99dd610 (patch) | |
tree | 52d34183d70c98b88ef6784e7518751d424f9391 /src/ziplist.c | |
parent | f674e83215af5f15096bf53a27de6c4ccf21faae (diff) | |
download | redis-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
Diffstat (limited to 'src/ziplist.c')
-rw-r--r-- | src/ziplist.c | 2 |
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); |