mirror of
https://github.com/fluencelabs/redis
synced 2025-04-11 19:56:03 +00:00
Streams: fix XADD + MAXLEN propagation due to var shadowing.
Clang should be more prone to return warnings by default when there is same-var-name shadowing. GCC does this and can avoid bugs like that.
This commit is contained in:
parent
a4e6aae6b8
commit
50595a5889
@ -352,8 +352,8 @@ int64_t streamTrimByLength(stream *s, size_t maxlen, int approx) {
|
|||||||
serverAssert(to_delete < entries);
|
serverAssert(to_delete < entries);
|
||||||
lp = lpReplaceInteger(lp,&p,entries-to_delete);
|
lp = lpReplaceInteger(lp,&p,entries-to_delete);
|
||||||
p = lpNext(lp,p); /* Seek deleted field. */
|
p = lpNext(lp,p); /* Seek deleted field. */
|
||||||
int64_t deleted = lpGetInteger(p);
|
int64_t marked_deleted = lpGetInteger(p);
|
||||||
lp = lpReplaceInteger(lp,&p,deleted+to_delete);
|
lp = lpReplaceInteger(lp,&p,marked_deleted+to_delete);
|
||||||
p = lpNext(lp,p); /* Seek num-of-fields in the master entry. */
|
p = lpNext(lp,p); /* Seek num-of-fields in the master entry. */
|
||||||
|
|
||||||
/* Skip all the master fields. */
|
/* Skip all the master fields. */
|
||||||
@ -394,8 +394,8 @@ int64_t streamTrimByLength(stream *s, size_t maxlen, int approx) {
|
|||||||
/* Here we should perform garbage collection in case at this point
|
/* Here we should perform garbage collection in case at this point
|
||||||
* there are too many entries deleted inside the listpack. */
|
* there are too many entries deleted inside the listpack. */
|
||||||
entries -= to_delete;
|
entries -= to_delete;
|
||||||
deleted += to_delete;
|
marked_deleted += to_delete;
|
||||||
if (entries + deleted > 10 && deleted > entries/2) {
|
if (entries + marked_deleted > 10 && marked_deleted > entries/2) {
|
||||||
/* TODO: perform a garbage collection. */
|
/* TODO: perform a garbage collection. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user