提交 50595a58 编写于 作者: A antirez

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.
上级 a4e6aae6
......@@ -352,8 +352,8 @@ int64_t streamTrimByLength(stream *s, size_t maxlen, int approx) {
serverAssert(to_delete < entries);
lp = lpReplaceInteger(lp,&p,entries-to_delete);
p = lpNext(lp,p); /* Seek deleted field. */
int64_t deleted = lpGetInteger(p);
lp = lpReplaceInteger(lp,&p,deleted+to_delete);
int64_t marked_deleted = lpGetInteger(p);
lp = lpReplaceInteger(lp,&p,marked_deleted+to_delete);
p = lpNext(lp,p); /* Seek num-of-fields in the master entry. */
/* 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
* there are too many entries deleted inside the listpack. */
entries -= to_delete;
deleted += to_delete;
if (entries + deleted > 10 && deleted > entries/2) {
marked_deleted += to_delete;
if (entries + marked_deleted > 10 && marked_deleted > entries/2) {
/* TODO: perform a garbage collection. */
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册