Commit 50595a58 authored by antirez's avatar antirez
Browse files

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.
parent a4e6aae6
...@@ -352,8 +352,8 @@ int64_t streamTrimByLength(stream *s, size_t maxlen, int approx) { ...@@ -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) { ...@@ -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. */
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment