diff options
author | antirez <antirez@gmail.com> | 2014-04-12 23:55:29 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2014-04-12 23:55:44 +0200 |
commit | 80140fa0069f48ee4753c90a9c6cec41ba26f44e (patch) | |
tree | 3054f6185f14c24d5c5fe25af25da82b072f0ac4 /src/hyperloglog.c | |
parent | 3c3c16561a5e0896109a26a1cb50555dae996868 (diff) | |
download | redis-80140fa0069f48ee4753c90a9c6cec41ba26f44e.tar.gz |
Fix hllSparseAdd() new sequence replacement when next is NULL.
sdsIncrLen() must be called anyway even if we are replacing the last
oppcode of the sparse representation.
Diffstat (limited to 'src/hyperloglog.c')
-rw-r--r-- | src/hyperloglog.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/hyperloglog.c b/src/hyperloglog.c index 119cbab1c..5a19443b4 100644 --- a/src/hyperloglog.c +++ b/src/hyperloglog.c @@ -784,10 +784,8 @@ int hllSparseAdd(robj *o, unsigned char *ele, size_t elesize) { int deltalen = seqlen-oldlen; if (deltalen > 0 && sdslen(o->ptr) > HLL_SPARSE_MAX) goto promote; - if (deltalen && next) { - memmove(next+deltalen,next,next-sparse); - sdsIncrLen(o->ptr,deltalen); - } + if (deltalen && next) memmove(next+deltalen,next,next-sparse); + sdsIncrLen(o->ptr,deltalen); memcpy(p,seq,seqlen); updated: |