Reduce scope of variables

This improves readability, keeps variables local, and
prevents the unintended use (e.g. typo) later on.
Found by Cppcheck (variableScope)
This commit is contained in:
Christoph Grüninger
2024-02-11 22:00:03 +01:00
parent a3f1b2448c
commit b921f1aad6
8 changed files with 27 additions and 28 deletions
+1 -2
View File
@@ -1372,7 +1372,6 @@ _shortestPath: /* cur, last_pos, best_mlen, best_off have to be set */
{ U32 const storeEnd = cur + 2;
U32 storeStart = storeEnd;
U32 stretchPos = cur;
ZSTD_optimal_t nextStretch;
DEBUGLOG(6, "start reverse traversal (last_pos:%u, cur:%u)",
last_pos, cur); (void)last_pos;
@@ -1390,7 +1389,7 @@ _shortestPath: /* cur, last_pos, best_mlen, best_off have to be set */
storeStart = storeEnd;
}
while (1) {
nextStretch = opt[stretchPos];
ZSTD_optimal_t nextStretch = opt[stretchPos];
opt[storeStart].litlen = nextStretch.litlen;
DEBUGLOG(6, "selected sequence (llen=%u,mlen=%u,ofc=%u)",
opt[storeStart].litlen, opt[storeStart].mlen, opt[storeStart].off);