refactor: fix clang/PVS warnings (#23731)

This commit is contained in:
zeertzjq 2023-05-23 18:11:03 +08:00 committed by GitHub
parent 30c02781ca
commit 677e02be4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 4 deletions

View File

@ -48,7 +48,6 @@
#include "nvim/highlight_group.h"
#include "nvim/input.h"
#include "nvim/keycodes.h"
#include "nvim/lua/secure.h"
#include "nvim/macros.h"
#include "nvim/main.h"
#include "nvim/mark.h"

View File

@ -3481,8 +3481,7 @@ void vim_deltempdir(void)
char *vim_gettempdir(void)
{
static int notfound = 0;
bool exists = false;
if (vim_tempdir == NULL || !(exists = os_isdir(vim_tempdir))) {
if (vim_tempdir == NULL || !os_isdir(vim_tempdir)) {
if (vim_tempdir != NULL) {
notfound++;
if (notfound == 1) {

View File

@ -55,6 +55,7 @@ defsfile:write(string.format([[
#include "nvim/help.h"
#include "nvim/indent.h"
#include "nvim/lua/executor.h"
#include "nvim/lua/secure.h"
#include "nvim/mapping.h"
#include "nvim/mark.h"
#include "nvim/match.h"

View File

@ -341,7 +341,7 @@ static int nlua_init_argv(lua_State *const L, char **argv, int argc, int lua_arg
lua_pushstring(L, argv[lua_arg0 - 1]);
lua_rawseti(L, -2, 0); // _G.arg[0] = "foo.lua"
for (; lua_arg0 >= 0 && i + lua_arg0 < argc; i++) {
for (; i + lua_arg0 < argc; i++) {
lua_pushstring(L, argv[i + lua_arg0]);
lua_rawseti(L, -2, i + 1); // _G.arg[i+1] = "--foo"
}

View File

@ -1,3 +1,6 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <lauxlib.h>
#include <lua.h>
#include <lualib.h>