Repository navigation
Commit 629e9c2
style(mcp): compare nullable strings through one helper
cppcheck 2.20 (the version the lint job pins) reports
knownConditionTrueFalse on two comparators in src/mcp/mcp.c whose
tie-breakers compare one strcmp result after another, each call with
inline "x ? x : \"\"" fallbacks. Neither function differs between these trees; which of
them is flagged depends on the rest of the lint source list. With
scripts/lint.sh --ci and cppcheck 2.20.0 built from source:
- main itself fails on search_result_cmp ("file_order != 0 is always
false");
- adding one more language grammar and its sources moves the finding
to project_record_compare ("by_root != 0 is always false");
- carrying each comparator's order in one variable instead still fails,
now as redundantAssignment on project_record_compare.
Both comparators now call nullable_strcmp(), which orders NULL like ""
exactly as the inline fallbacks did. lint-cppcheck passes again on
main and with the additional sources. Comparison order and results are
unchanged for every input.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Sarlette <282189207+SarletteD@users.noreply.github.com>1 parent 64c23fa commit 629e9c2
1 file changed
Lines changed: 10 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2723 | 2723 | | |
2724 | 2724 | | |
2725 | 2725 | | |
| 2726 | + | |
| 2727 | + | |
| 2728 | + | |
| 2729 | + | |
| 2730 | + | |
2726 | 2731 | | |
2727 | 2732 | | |
2728 | 2733 | | |
2729 | | - | |
| 2734 | + | |
2730 | 2735 | | |
2731 | 2736 | | |
2732 | 2737 | | |
2733 | | - | |
| 2738 | + | |
2734 | 2739 | | |
2735 | 2740 | | |
2736 | 2741 | | |
2737 | | - | |
| 2742 | + | |
2738 | 2743 | | |
2739 | 2744 | | |
2740 | 2745 | | |
| |||
12605 | 12610 | | |
12606 | 12611 | | |
12607 | 12612 | | |
12608 | | - | |
12609 | | - | |
| 12613 | + | |
12610 | 12614 | | |
12611 | 12615 | | |
12612 | 12616 | | |
12613 | | - | |
| 12617 | + | |
12614 | 12618 | | |
12615 | 12619 | | |
12616 | 12620 | | |
| |||
0 commit comments