Repository navigation
Commit 60449f8
committed
style(mcp): pick the unreadable-count hint with an if/else chain
cppcheck 2.20 flags the nested ternary in handle_index_status:
src/mcp/mcp.c:6705:30: style: Condition 'nodes<0' is always false
[knownConditionTrueFalse]
After the `nodes < 0 && edges < 0` arm, cppcheck's value flow takes
`nodes < 0` to be the false half of that conjunction and rejects the
second test. Select the hint with a plain if / else-if / else chain into
a `const char *hint` and add it once, rather than suppressing the check.
The three messages are byte-identical to before — only the line wrapping
of the adjacent literals moved — so status, counts and hint text are
unchanged and the tests added in the previous commit still describe the
behaviour.
Verified with cppcheck 2.21 locally using the flags from
Makefile.cbm's lint-cppcheck target: the finding is reproduced on the
parent commit and gone here, with no new ones. clang-format reports no
drift over the changed lines.
Signed-off-by: kavish-19 <[email protected]>1 parent 73c509f commit 60449f8
1 file changed
Lines changed: 13 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6696 | 6696 | | |
6697 | 6697 | | |
6698 | 6698 | | |
6699 | | - | |
6700 | | - | |
6701 | | - | |
6702 | | - | |
6703 | | - | |
6704 | | - | |
6705 | | - | |
6706 | | - | |
6707 | | - | |
6708 | | - | |
6709 | | - | |
6710 | | - | |
| 6699 | + | |
| 6700 | + | |
| 6701 | + | |
| 6702 | + | |
| 6703 | + | |
| 6704 | + | |
| 6705 | + | |
| 6706 | + | |
| 6707 | + | |
| 6708 | + | |
| 6709 | + | |
| 6710 | + | |
| 6711 | + | |
6711 | 6712 | | |
6712 | 6713 | | |
6713 | 6714 | | |
| |||
0 commit comments