Merge pull request #17571 from zeertzjq/pvs-autocmd

Some clang and PVS fixes
This commit is contained in:
zeertzjq
2022-03-03 08:25:28 +08:00
committed by GitHub
2 changed files with 2 additions and 12 deletions

View File

@@ -131,10 +131,8 @@ Array nvim_get_autocmds(Dict(get_autocmds) *opts, Error *err)
continue;
}
for (AutoPat *ap = au_get_autopat_for_event(event);
ap != NULL;
ap = ap->next) {
if (ap == NULL || ap->cmds == NULL) {
for (AutoPat *ap = au_get_autopat_for_event(event); ap != NULL; ap = ap->next) {
if (ap->cmds == NULL) {
continue;
}
@@ -426,13 +424,6 @@ Integer nvim_create_autocmd(uint64_t channel_id, Object event, Dict(create_autoc
ADD(patterns, STRING_OBJ(cstr_to_string((char *)pattern_buflocal)));
}
if (aucmd.type == CALLABLE_NONE) {
api_set_error(err,
kErrorTypeValidation,
"'command' or 'callback' is required");
goto cleanup;
}
if (opts->desc.type != kObjectTypeNil) {
if (opts->desc.type == kObjectTypeString) {
desc = opts->desc.data.string.data;

View File

@@ -887,7 +887,6 @@ int do_autocmd_event(event_T event, char_u *pat, bool once, int nested, char_u *
while (patlen) {
// detect special <buffer[=X]> buffer-local patterns
is_buflocal = aupat_is_buflocal(pat, patlen);
buflocal_nr = 0;
if (is_buflocal) {
buflocal_nr = aupat_get_buflocal_nr(pat, patlen);