refactor: fix clang NonNullParamChecker warnings (#28327)

This commit is contained in:
zeertzjq 2024-04-14 21:48:32 +08:00 committed by GitHub
parent c34c31af73
commit f6a3fdd684
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 4 deletions

View File

@ -844,7 +844,6 @@ add_glob_target(
--checks=' --checks='
-*, -*,
clang-analyzer-*, clang-analyzer-*,
-clang-analyzer-core.NonNullParamChecker,
-clang-analyzer-core.NullDereference, -clang-analyzer-core.NullDereference,
-clang-analyzer-core.UndefinedBinaryOperatorResult, -clang-analyzer-core.UndefinedBinaryOperatorResult,
-clang-analyzer-core.uninitialized.Assign, -clang-analyzer-core.uninitialized.Assign,

View File

@ -5320,7 +5320,7 @@ static regprog_T *bt_regcomp(uint8_t *expr, int re_flags)
} }
// Remember whether this pattern has any \z specials in it. // Remember whether this pattern has any \z specials in it.
r->reghasz = (uint8_t)re_has_z; r->reghasz = (uint8_t)re_has_z;
scan = r->program + 1; // First BRANCH. scan = &r->program[1]; // First BRANCH.
if (OP(regnext(scan)) == END) { // Only one top-level choice. if (OP(regnext(scan)) == END) { // Only one top-level choice.
scan = OPERAND(scan); scan = OPERAND(scan);
@ -7322,7 +7322,7 @@ static int regtry(bt_regprog_T *prog, colnr_T col, proftime_T *tm, int *timed_ou
// Clear the external match subpointers if necessaey. // Clear the external match subpointers if necessaey.
rex.need_clear_zsubexpr = (prog->reghasz == REX_SET); rex.need_clear_zsubexpr = (prog->reghasz == REX_SET);
if (regmatch(prog->program + 1, tm, timed_out) == 0) { if (regmatch(&prog->program[1], tm, timed_out) == 0) {
return 0; return 0;
} }
@ -7664,7 +7664,7 @@ static void regdump(uint8_t *pattern, bt_regprog_T *r)
fprintf(f, "-------------------------------------\n\r\nregcomp(%s):\r\n", fprintf(f, "-------------------------------------\n\r\nregcomp(%s):\r\n",
pattern); pattern);
s = r->program + 1; s = &r->program[1];
// Loop until we find the END that isn't before a referred next (an END // Loop until we find the END that isn't before a referred next (an END
// can also appear in a NOMATCH operand). // can also appear in a NOMATCH operand).
while (op != END || s <= end) { while (op != END || s <= end) {

View File

@ -1959,6 +1959,7 @@ int win_splitmove(win_T *wp, int size, int flags)
// Remove the window and frame from the tree of frames. Don't flatten any // Remove the window and frame from the tree of frames. Don't flatten any
// frames yet so we can restore things if win_split_ins fails. // frames yet so we can restore things if win_split_ins fails.
winframe_remove(wp, &dir, NULL, &unflat_altfr); winframe_remove(wp, &dir, NULL, &unflat_altfr);
assert(unflat_altfr != NULL);
win_remove(wp, NULL); win_remove(wp, NULL);
last_status(false); // may need to remove last status line last_status(false); // may need to remove last status line
win_comp_pos(); // recompute window positions win_comp_pos(); // recompute window positions
@ -1967,6 +1968,7 @@ int win_splitmove(win_T *wp, int size, int flags)
// Split a window on the desired side and put "wp" there. // Split a window on the desired side and put "wp" there.
if (win_split_ins(size, flags, wp, dir, unflat_altfr) == NULL) { if (win_split_ins(size, flags, wp, dir, unflat_altfr) == NULL) {
if (!wp->w_floating) { if (!wp->w_floating) {
assert(unflat_altfr != NULL);
// win_split_ins doesn't change sizes or layout if it fails to insert an // win_split_ins doesn't change sizes or layout if it fails to insert an
// existing window, so just undo winframe_remove. // existing window, so just undo winframe_remove.
winframe_restore(wp, dir, unflat_altfr); winframe_restore(wp, dir, unflat_altfr);