Repository navigation
Conversation
DeusData
force-pushed
the
fix/issue-1967
branch
2 times, most recently
from
October 1, 2026 19:00
897a28a to
3b0ffeb
Compare
Three places in internal/cbm/cbm.c counted the lines of the same source buffer with two different conventions. cbm_count_lines (parse_unusable 80% threshold) ignored a final newline, while the inline counter that sizes the preprocessed-line map (orig_lines) and cbm_line_offsets (the recovery-gap walker) counted every newline, so on any file ending in a newline -- nearly every file -- they disagreed by one. Nothing produced a wrong answer: every consumer of the larger count either clamps to it or sees the phantom last line as blank. The risk was the next reader picking up one convention without knowing the other existed. Add cbm_source_line_count() as the single helper, with the convention documented beside it: a '\n' terminates a line and opens no new one; an empty buffer counts as 1 line. All three call sites use it; the old static cbm_count_lines is gone. Test: parse_coverage::source_line_count_one_convention pins the convention (trailing newline, no final newline, CRLF, empty buffer, blank last line, src_len bound). Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
DeusData
force-pushed
the
fix/issue-1967
branch
from
October 4, 2026 16:48
3b0ffeb to
14ed8ce
Compare
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three places in internal/cbm/cbm.c counted the lines of the same source
buffer with two different conventions. cbm_count_lines (parse_unusable
80% threshold) ignored a final newline, while the inline counter that
sizes the preprocessed-line map (orig_lines) and cbm_line_offsets (the
recovery-gap walker) counted every newline, so on any file ending in a
newline -- nearly every file -- they disagreed by one.
Nothing produced a wrong answer: every consumer of the larger count
either clamps to it or sees the phantom last line as blank. The risk
was the next reader picking up one convention without knowing the
other existed.
Add cbm_source_line_count() as the single helper, with the convention
documented beside it: a '\n' terminates a line and opens no new one;
an empty buffer counts as 1 line. All three call sites use it; the
old static cbm_count_lines is gone.
Test: parse_coverage::source_line_count_one_convention pins the
convention (trailing newline, no final newline, CRLF, empty buffer,
blank last line, src_len bound).
Fixes #1967