summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSverker Eriksson <sverker@erlang.org>2021-02-22 20:49:40 +0100
committerSverker Eriksson <sverker@erlang.org>2021-02-23 14:02:24 +0100
commitd758e62d1ab8ba4b9919a16ba0df10b575148f38 (patch)
tree91e0d4a1069da5eea71ec53945a00dcf881e6483
parentec665844a22c0a938c9d944736778df6d204a015 (diff)
downloaderlang-d758e62d1ab8ba4b9919a16ba0df10b575148f38.tar.gz
erts: Silence CodeChecker in erts_encode_ext_dist_header_finalize
-rw-r--r--erts/emulator/beam/external.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/erts/emulator/beam/external.c b/erts/emulator/beam/external.c
index ac9c8f4b9e..e071fa08a5 100644
--- a/erts/emulator/beam/external.c
+++ b/erts/emulator/beam/external.c
@@ -497,7 +497,7 @@ Sint erts_encode_ext_dist_header_finalize(ErtsDistOutputBuf* ob,
int iix, flgs_bytes, flgs_buf_ix, used_half_bytes;
ErtsAtomCache* cache = dep->cache;
#ifdef DEBUG
- int tot_used_half_bytes;
+ int tot_used_half_bytes, top_buf_ix;
#endif
flgs_bytes = ERTS_DIST_HDR_ATOM_CACHE_FLAG_BYTES(ci);
@@ -562,9 +562,13 @@ Sint erts_encode_ext_dist_header_finalize(ErtsDistOutputBuf* ob,
}
ASSERT(tot_used_half_bytes == 2*flgs_bytes);
flgs_buf[flgs_buf_ix] = flgs;
+#ifdef DEBUG
+ top_buf_ix = flgs_buf_ix;
+#endif
flgs_buf_ix = 0;
while (1) {
- flgs = flgs_buf[flgs_buf_ix];
+ ASSERT(flgs_buf_ix <= top_buf_ix);
+ flgs = flgs_buf[flgs_buf_ix];
if (flgs_bytes > 4) {
*--ep = (byte) ((flgs >> 24) & 0xff);
*--ep = (byte) ((flgs >> 16) & 0xff);
@@ -574,6 +578,7 @@ Sint erts_encode_ext_dist_header_finalize(ErtsDistOutputBuf* ob,
flgs_bytes -= 4;
}
else {
+ ASSERT(flgs_buf_ix == top_buf_ix);
switch (flgs_bytes) {
case 4:
*--ep = (byte) ((flgs >> 24) & 0xff);