refactor(uncrustify): format all c files

This commit is contained in:
Dundar Göc 2022-03-09 21:19:37 +01:00
parent d0cb8744d8
commit 7e3bdc75e4
26 changed files with 151 additions and 158 deletions

View File

@ -63,26 +63,26 @@ Array nvim_get_autocmds(Dict(get_autocmds) *opts, Error *err)
int group = 0; int group = 0;
switch (opts->group.type) { switch (opts->group.type) {
case kObjectTypeNil: case kObjectTypeNil:
break; break;
case kObjectTypeString: case kObjectTypeString:
group = augroup_find(opts->group.data.string.data); group = augroup_find(opts->group.data.string.data);
if (group < 0) { if (group < 0) {
api_set_error(err, kErrorTypeValidation, "invalid augroup passed."); api_set_error(err, kErrorTypeValidation, "invalid augroup passed.");
goto cleanup;
}
break;
case kObjectTypeInteger:
group = (int)opts->group.data.integer;
char *name = augroup_name(group);
if (!augroup_exists(name)) {
api_set_error(err, kErrorTypeValidation, "invalid augroup passed.");
goto cleanup;
}
break;
default:
api_set_error(err, kErrorTypeValidation, "group must be a string or an integer.");
goto cleanup; goto cleanup;
}
break;
case kObjectTypeInteger:
group = (int)opts->group.data.integer;
char *name = augroup_name(group);
if (!augroup_exists(name)) {
api_set_error(err, kErrorTypeValidation, "invalid augroup passed.");
goto cleanup;
}
break;
default:
api_set_error(err, kErrorTypeValidation, "group must be a string or an integer.");
goto cleanup;
} }
if (opts->event.type != kObjectTypeNil) { if (opts->event.type != kObjectTypeNil) {
@ -415,28 +415,28 @@ Integer nvim_create_autocmd(uint64_t channel_id, Object event, Dict(create_autoc
bool is_nested = api_object_to_bool(opts->nested, "nested", false, err); bool is_nested = api_object_to_bool(opts->nested, "nested", false, err);
switch (opts->group.type) { switch (opts->group.type) {
case kObjectTypeNil: case kObjectTypeNil:
break; break;
case kObjectTypeString: case kObjectTypeString:
au_group = augroup_find(opts->group.data.string.data); au_group = augroup_find(opts->group.data.string.data);
if (au_group == AUGROUP_ERROR) { if (au_group == AUGROUP_ERROR) {
api_set_error(err, api_set_error(err,
kErrorTypeValidation, kErrorTypeValidation,
"invalid augroup: %s", opts->group.data.string.data); "invalid augroup: %s", opts->group.data.string.data);
goto cleanup;
}
break;
case kObjectTypeInteger:
au_group = (int)opts->group.data.integer;
char *name = augroup_name(au_group);
if (!augroup_exists(name)) {
api_set_error(err, kErrorTypeValidation, "invalid augroup: %d", au_group);
goto cleanup;
}
break;
default:
api_set_error(err, kErrorTypeValidation, "'group' must be a string or an integer.");
goto cleanup; goto cleanup;
}
break;
case kObjectTypeInteger:
au_group = (int)opts->group.data.integer;
char *name = augroup_name(au_group);
if (!augroup_exists(name)) {
api_set_error(err, kErrorTypeValidation, "invalid augroup: %d", au_group);
goto cleanup;
}
break;
default:
api_set_error(err, kErrorTypeValidation, "'group' must be a string or an integer.");
goto cleanup;
} }
if (opts->pattern.type != kObjectTypeNil && opts->buffer.type != kObjectTypeNil) { if (opts->pattern.type != kObjectTypeNil && opts->buffer.type != kObjectTypeNil) {
@ -659,28 +659,28 @@ void nvim_do_autocmd(Object event, Dict(do_autocmd) *opts, Error *err)
} }
switch (opts->group.type) { switch (opts->group.type) {
case kObjectTypeNil: case kObjectTypeNil:
break; break;
case kObjectTypeString: case kObjectTypeString:
au_group = augroup_find(opts->group.data.string.data); au_group = augroup_find(opts->group.data.string.data);
if (au_group == AUGROUP_ERROR) { if (au_group == AUGROUP_ERROR) {
api_set_error(err, api_set_error(err,
kErrorTypeValidation, kErrorTypeValidation,
"invalid augroup: %s", opts->group.data.string.data); "invalid augroup: %s", opts->group.data.string.data);
goto cleanup;
}
break;
case kObjectTypeInteger:
au_group = (int)opts->group.data.integer;
char *name = augroup_name(au_group);
if (!augroup_exists(name)) {
api_set_error(err, kErrorTypeValidation, "invalid augroup: %d", au_group);
goto cleanup;
}
break;
default:
api_set_error(err, kErrorTypeValidation, "'group' must be a string or an integer.");
goto cleanup; goto cleanup;
}
break;
case kObjectTypeInteger:
au_group = (int)opts->group.data.integer;
char *name = augroup_name(au_group);
if (!augroup_exists(name)) {
api_set_error(err, kErrorTypeValidation, "invalid augroup: %d", au_group);
goto cleanup;
}
break;
default:
api_set_error(err, kErrorTypeValidation, "'group' must be a string or an integer.");
goto cleanup;
} }
if (opts->buffer.type != kObjectTypeNil) { if (opts->buffer.type != kObjectTypeNil) {

View File

@ -965,8 +965,7 @@ void nvim_buf_set_keymap(uint64_t channel_id, Buffer buffer, String mode, String
/// @see |nvim_del_keymap()| /// @see |nvim_del_keymap()|
/// ///
/// @param buffer Buffer handle, or 0 for current buffer /// @param buffer Buffer handle, or 0 for current buffer
void nvim_buf_del_keymap(uint64_t channel_id, Buffer buffer, String mode, void nvim_buf_del_keymap(uint64_t channel_id, Buffer buffer, String mode, String lhs, Error *err)
String lhs, Error *err)
FUNC_API_SINCE(6) FUNC_API_SINCE(6)
{ {
String rhs = { .data = "", .size = 0 }; String rhs = { .data = "", .size = 0 };
@ -1380,8 +1379,8 @@ Object nvim_buf_call(Buffer buffer, LuaRef fun, Error *err)
/// @param buffer Buffer handle, or 0 for current buffer. /// @param buffer Buffer handle, or 0 for current buffer.
/// @param[out] err Error details, if any. /// @param[out] err Error details, if any.
/// @see nvim_add_user_command /// @see nvim_add_user_command
void nvim_buf_add_user_command(Buffer buffer, String name, Object command, void nvim_buf_add_user_command(Buffer buffer, String name, Object command, Dict(user_command) *opts,
Dict(user_command) *opts, Error *err) Error *err)
FUNC_API_SINCE(9) FUNC_API_SINCE(9)
{ {
buf_T *target_buf = find_buffer_by_handle(buffer, err); buf_T *target_buf = find_buffer_by_handle(buffer, err);

View File

@ -722,15 +722,15 @@ Object nvim_get_option_value(String name, Dict(option) *opts, Error *err)
break; break;
case 2: case 2:
switch (numval) { switch (numval) {
case 0: case 0:
case 1: case 1:
rv = BOOLEAN_OBJ(numval); rv = BOOLEAN_OBJ(numval);
break; break;
default: default:
// Boolean options that return something other than 0 or 1 should return nil. Currently this // Boolean options that return something other than 0 or 1 should return nil. Currently this
// only applies to 'autoread' which uses -1 as a local value to indicate "unset" // only applies to 'autoread' which uses -1 as a local value to indicate "unset"
rv = NIL; rv = NIL;
break; break;
} }
break; break;
default: default:

View File

@ -34,9 +34,9 @@
#include "nvim/channel.h" #include "nvim/channel.h"
#include "nvim/charset.h" #include "nvim/charset.h"
#include "nvim/cursor.h" #include "nvim/cursor.h"
#include "nvim/decoration.h"
#include "nvim/diff.h" #include "nvim/diff.h"
#include "nvim/digraph.h" #include "nvim/digraph.h"
#include "nvim/decoration.h"
#include "nvim/eval.h" #include "nvim/eval.h"
#include "nvim/ex_cmds.h" #include "nvim/ex_cmds.h"
#include "nvim/ex_cmds2.h" #include "nvim/ex_cmds2.h"
@ -4508,7 +4508,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
char_u *start = stl_items[stl_separator_locations[i]].start; char_u *start = stl_items[stl_separator_locations[i]].start;
char_u *seploc = start + dislocation; char_u *seploc = start + dislocation;
STRMOVE(seploc, start); STRMOVE(seploc, start);
for (char_u *s = start; s < seploc; ) { for (char_u *s = start; s < seploc;) {
MB_CHAR2BYTES(fillchar, s); MB_CHAR2BYTES(fillchar, s);
} }

View File

@ -106,10 +106,10 @@ EXTERN bool provider_active INIT(= false);
static inline bool decor_has_sign(Decoration *decor) static inline bool decor_has_sign(Decoration *decor)
{ {
return decor->sign_text return decor->sign_text
|| decor->sign_hl_id || decor->sign_hl_id
|| decor->number_hl_id || decor->number_hl_id
|| decor->line_hl_id || decor->line_hl_id
|| decor->cursorline_hl_id; || decor->cursorline_hl_id;
} }
#ifdef INCLUDE_GENERATED_DECLARATIONS #ifdef INCLUDE_GENERATED_DECLARATIONS

View File

@ -2710,7 +2710,7 @@ bool next_for_item(void *fi_void, char_u *arg)
tv.vval.v_string = vim_strnsave(fi->fi_string + fi->fi_byte_idx, len); tv.vval.v_string = vim_strnsave(fi->fi_string + fi->fi_byte_idx, len);
fi->fi_byte_idx += len; fi->fi_byte_idx += len;
const int result const int result
= ex_let_vars(arg, &tv, true, fi->fi_semicolon, fi->fi_varcount, false, NULL) == OK; = ex_let_vars(arg, &tv, true, fi->fi_semicolon, fi->fi_varcount, false, NULL) == OK;
xfree(tv.vval.v_string); xfree(tv.vval.v_string);
return result; return result;
} }

View File

@ -1171,10 +1171,10 @@ void callback_put(Callback *cb, typval_T *tv)
func_ref(cb->data.funcref); func_ref(cb->data.funcref);
break; break;
case kCallbackLua: case kCallbackLua:
// TODO(tjdevries): Unified Callback. // TODO(tjdevries): Unified Callback.
// At this point this isn't possible, but it'd be nice to put // At this point this isn't possible, but it'd be nice to put
// these handled more neatly in one place. // these handled more neatly in one place.
// So instead, we just do the default and put nil // So instead, we just do the default and put nil
default: default:
tv->v_type = VAR_SPECIAL; tv->v_type = VAR_SPECIAL;
tv->vval.v_special = kSpecialVarNull; tv->vval.v_special = kSpecialVarNull;

View File

@ -11,8 +11,8 @@
#include "nvim/event/loop.h" #include "nvim/event/loop.h"
#include "nvim/event/rstream.h" #include "nvim/event/rstream.h"
#include "nvim/log.h" #include "nvim/log.h"
#include "nvim/memory.h"
#include "nvim/main.h" #include "nvim/main.h"
#include "nvim/memory.h"
#include "nvim/vim.h" #include "nvim/vim.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS #ifdef INCLUDE_GENERATED_DECLARATIONS

View File

@ -1,8 +1,8 @@
#ifndef NVIM_EX_DOCMD_H #ifndef NVIM_EX_DOCMD_H
#define NVIM_EX_DOCMD_H #define NVIM_EX_DOCMD_H
#include "nvim/ex_cmds_defs.h"
#include "nvim/eval/funcs.h" #include "nvim/eval/funcs.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/globals.h" #include "nvim/globals.h"
// flags for do_cmdline() // flags for do_cmdline()

View File

@ -118,7 +118,7 @@ void extmark_set(buf_T *buf, uint32_t ns_id, uint32_t *idp, int row, colnr_T col
} }
mtkey_t mark = { { row, col }, ns_id, id, 0, mtkey_t mark = { { row, col }, ns_id, id, 0,
mt_flags(right_gravity, decor_level), 0, NULL }; mt_flags(right_gravity, decor_level), 0, NULL };
if (decor_full) { if (decor_full) {
mark.decor_full = decor; mark.decor_full = decor;
} else if (decor) { } else if (decor) {

View File

@ -2,8 +2,8 @@
#define NVIM_EXTMARK_H #define NVIM_EXTMARK_H
#include "nvim/buffer_defs.h" #include "nvim/buffer_defs.h"
#include "nvim/extmark_defs.h"
#include "nvim/decoration.h" #include "nvim/decoration.h"
#include "nvim/extmark_defs.h"
#include "nvim/marktree.h" #include "nvim/marktree.h"
#include "nvim/pos.h" #include "nvim/pos.h"

View File

@ -819,9 +819,9 @@ HlAttrs dict2hlattrs(Dict(highlight) *dict, bool use_rgb, int *link_id, Error *e
bool cterm_mask_provided = false; bool cterm_mask_provided = false;
#define CHECK_FLAG(d, m, name, extra, flag) \ #define CHECK_FLAG(d, m, name, extra, flag) \
if (api_object_to_bool(d->name ## extra, #name, false, err)) { \ if (api_object_to_bool(d->name##extra, #name, false, err)) { \
m = m | flag; \ m = m | flag; \
} }
CHECK_FLAG(dict, mask, bold, , HL_BOLD); CHECK_FLAG(dict, mask, bold, , HL_BOLD);
CHECK_FLAG(dict, mask, standout, , HL_STANDOUT); CHECK_FLAG(dict, mask, standout, , HL_STANDOUT);
@ -906,7 +906,6 @@ HlAttrs dict2hlattrs(Dict(highlight) *dict, bool use_rgb, int *link_id, Error *e
CHECK_FLAG(cterm, cterm_mask, reverse, , HL_INVERSE); CHECK_FLAG(cterm, cterm_mask, reverse, , HL_INVERSE);
CHECK_FLAG(cterm, cterm_mask, strikethrough, , HL_STRIKETHROUGH); CHECK_FLAG(cterm, cterm_mask, strikethrough, , HL_STRIKETHROUGH);
CHECK_FLAG(cterm, cterm_mask, nocombine, , HL_NOCOMBINE); CHECK_FLAG(cterm, cterm_mask, nocombine, , HL_NOCOMBINE);
} else if (dict->cterm.type == kObjectTypeArray && dict->cterm.data.array.size == 0) { } else if (dict->cterm.type == kObjectTypeArray && dict->cterm.data.array.size == 0) {
// empty list from Lua API should clear all cterm attributes // empty list from Lua API should clear all cterm attributes
// TODO(clason): handle via gen_api_dispatch // TODO(clason): handle via gen_api_dispatch

View File

@ -9,9 +9,9 @@
#include "nvim/func_attr.h" #include "nvim/func_attr.h"
#include "nvim/getchar.h" #include "nvim/getchar.h"
#include "nvim/input.h"
#include "nvim/mbyte.h" #include "nvim/mbyte.h"
#include "nvim/memory.h" #include "nvim/memory.h"
#include "nvim/input.h"
#include "nvim/mouse.h" #include "nvim/mouse.h"
#include "nvim/os/input.h" #include "nvim/os/input.h"
#include "nvim/ui.h" #include "nvim/ui.h"

View File

@ -15,8 +15,8 @@
#include "nvim/buffer_defs.h" #include "nvim/buffer_defs.h"
#include "nvim/change.h" #include "nvim/change.h"
#include "nvim/cursor.h" #include "nvim/cursor.h"
#include "nvim/eval/userfunc.h"
#include "nvim/eval/typval.h" #include "nvim/eval/typval.h"
#include "nvim/eval/userfunc.h"
#include "nvim/event/loop.h" #include "nvim/event/loop.h"
#include "nvim/event/time.h" #include "nvim/event/time.h"
#include "nvim/ex_cmds2.h" #include "nvim/ex_cmds2.h"
@ -139,17 +139,17 @@ static void nlua_luv_error_event(void **argv)
luv_err_t type = (luv_err_t)(intptr_t)argv[1]; luv_err_t type = (luv_err_t)(intptr_t)argv[1];
msg_ext_set_kind("lua_error"); msg_ext_set_kind("lua_error");
switch (type) { switch (type) {
case kCallback: case kCallback:
semsg_multiline("Error executing luv callback:\n%s", error); semsg_multiline("Error executing luv callback:\n%s", error);
break; break;
case kThread: case kThread:
semsg_multiline("Error in luv thread:\n%s", error); semsg_multiline("Error in luv thread:\n%s", error);
break; break;
case kThreadCallback: case kThreadCallback:
semsg_multiline("Error in luv callback, thread:\n%s", error); semsg_multiline("Error in luv callback, thread:\n%s", error);
break; break;
default: default:
break; break;
} }
xfree(error); xfree(error);
} }
@ -189,21 +189,18 @@ static int nlua_luv_cfpcall(lua_State *lstate, int nargs, int nresult, int flags
return retval; return retval;
} }
static int nlua_luv_thread_cb_cfpcall(lua_State *lstate, int nargs, int nresult, static int nlua_luv_thread_cb_cfpcall(lua_State *lstate, int nargs, int nresult, int flags)
int flags)
{ {
return nlua_luv_thread_common_cfpcall(lstate, nargs, nresult, flags, true); return nlua_luv_thread_common_cfpcall(lstate, nargs, nresult, flags, true);
} }
static int nlua_luv_thread_cfpcall(lua_State *lstate, int nargs, int nresult, static int nlua_luv_thread_cfpcall(lua_State *lstate, int nargs, int nresult, int flags)
int flags)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_ALL
{ {
return nlua_luv_thread_common_cfpcall(lstate, nargs, nresult, flags, false); return nlua_luv_thread_common_cfpcall(lstate, nargs, nresult, flags, false);
} }
static int nlua_luv_thread_cfcpcall(lua_State *lstate, lua_CFunction func, static int nlua_luv_thread_cfcpcall(lua_State *lstate, lua_CFunction func, void *ud, int flags)
void *ud, int flags)
FUNC_ATTR_NONNULL_ARG(1, 2) FUNC_ATTR_NONNULL_ARG(1, 2)
{ {
lua_pushcfunction(lstate, func); lua_pushcfunction(lstate, func);
@ -212,8 +209,8 @@ static int nlua_luv_thread_cfcpcall(lua_State *lstate, lua_CFunction func,
return retval; return retval;
} }
static int nlua_luv_thread_common_cfpcall(lua_State *lstate, int nargs, int nresult, static int nlua_luv_thread_common_cfpcall(lua_State *lstate, int nargs, int nresult, int flags,
int flags, bool is_callback) bool is_callback)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_ALL
{ {
int retval; int retval;
@ -228,9 +225,9 @@ static int nlua_luv_thread_common_cfpcall(lua_State *lstate, int nargs, int nres
mch_errmsg("\n"); mch_errmsg("\n");
lua_close(lstate); lua_close(lstate);
#ifdef WIN32 #ifdef WIN32
ExitThread(0); ExitThread(0);
#else #else
pthread_exit(0); pthread_exit(0);
#endif #endif
} }
const char *error = lua_tostring(lstate, -1); const char *error = lua_tostring(lstate, -1);
@ -565,9 +562,9 @@ static bool nlua_init_packages(lua_State *lstate)
lua_getglobal(lstate, "require"); lua_getglobal(lstate, "require");
lua_pushstring(lstate, "vim._init_packages"); lua_pushstring(lstate, "vim._init_packages");
if (nlua_pcall(lstate, 1, 0)) { if (nlua_pcall(lstate, 1, 0)) {
mch_errmsg(lua_tostring(lstate, -1)); mch_errmsg(lua_tostring(lstate, -1));
mch_errmsg("\n"); mch_errmsg("\n");
return false; return false;
} }
return true; return true;

View File

@ -4,8 +4,8 @@
#include <lauxlib.h> #include <lauxlib.h>
#include <lua.h> #include <lua.h>
#include "nvim/assert.h"
#include "nvim/api/private/defs.h" #include "nvim/api/private/defs.h"
#include "nvim/assert.h"
#include "nvim/eval/typval.h" #include "nvim/eval/typval.h"
#include "nvim/ex_cmds_defs.h" #include "nvim/ex_cmds_defs.h"
#include "nvim/ex_docmd.h" #include "nvim/ex_docmd.h"
@ -16,9 +16,9 @@
void nlua_add_api_functions(lua_State *lstate) REAL_FATTR_NONNULL_ALL; void nlua_add_api_functions(lua_State *lstate) REAL_FATTR_NONNULL_ALL;
typedef struct { typedef struct {
LuaRef nil_ref; LuaRef nil_ref;
LuaRef empty_dict_ref; LuaRef empty_dict_ref;
int ref_count; int ref_count;
#if __has_feature(address_sanitizer) #if __has_feature(address_sanitizer)
PMap(handle_T) ref_markers; PMap(handle_T) ref_markers;
#endif #endif

View File

@ -1,12 +1,12 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check // 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 // it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <lua.h>
#include <lauxlib.h> #include <lauxlib.h>
#include <lua.h>
#include "nvim/lua/spell.h"
#include "nvim/spell.h" #include "nvim/spell.h"
#include "nvim/vim.h" #include "nvim/vim.h"
#include "nvim/lua/spell.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS #ifdef INCLUDE_GENERATED_DECLARATIONS
# include "lua/spell.c.generated.h" # include "lua/spell.c.generated.h"
@ -45,7 +45,7 @@ int nlua_spell_check(lua_State *lstate)
size_t pos = 0; size_t pos = 0;
int capcol = -1; int capcol = -1;
int no_res = 0; int no_res = 0;
const char * result; const char *result;
lua_createtable(lstate, 0, 0); lua_createtable(lstate, 0, 0);
@ -90,7 +90,7 @@ int nlua_spell_check(lua_State *lstate)
static const luaL_Reg spell_functions[] = { static const luaL_Reg spell_functions[] = {
{ "check", nlua_spell_check }, { "check", nlua_spell_check },
{ NULL , NULL } { NULL, NULL }
}; };
int luaopen_spell(lua_State *L) int luaopen_spell(lua_State *L)

View File

@ -28,10 +28,10 @@
#include "nvim/globals.h" #include "nvim/globals.h"
#include "nvim/lua/converter.h" #include "nvim/lua/converter.h"
#include "nvim/lua/executor.h" #include "nvim/lua/executor.h"
#include "nvim/lua/spell.h"
#include "nvim/lua/stdlib.h" #include "nvim/lua/stdlib.h"
#include "nvim/lua/treesitter.h" #include "nvim/lua/treesitter.h"
#include "nvim/lua/xdiff.h" #include "nvim/lua/xdiff.h"
#include "nvim/lua/spell.h"
#include "nvim/macros.h" #include "nvim/macros.h"
#include "nvim/map.h" #include "nvim/map.h"
#include "nvim/memline.h" #include "nvim/memline.h"
@ -411,7 +411,7 @@ int nlua_getvar(lua_State *lstate)
dictitem_T *di = tv_dict_find(dict, name, (ptrdiff_t)len); dictitem_T *di = tv_dict_find(dict, name, (ptrdiff_t)len);
if (di == NULL && dict == &globvardict) { // try to autoload script if (di == NULL && dict == &globvardict) { // try to autoload script
if (!script_autoload(name, len, false) || aborting()) { if (!script_autoload(name, len, false) || aborting()) {
return 0; // nil return 0; // nil
} }
di = tv_dict_find(dict, name, (ptrdiff_t)len); di = tv_dict_find(dict, name, (ptrdiff_t)len);
} }

View File

@ -558,7 +558,7 @@ void marktree_revise(MarkTree *b, MarkTreeIter *itr, uint8_t decor_level, mtkey_
{ {
// TODO(bfredl): clean up this mess and re-instantiate &= and |= forms // TODO(bfredl): clean up this mess and re-instantiate &= and |= forms
// once we upgrade to a non-broken version of gcc in functionaltest-lua CI // once we upgrade to a non-broken version of gcc in functionaltest-lua CI
rawkey(itr).flags = (uint16_t)(rawkey(itr).flags & (uint16_t)~MT_FLAG_DECOR_MASK); rawkey(itr).flags = (uint16_t)(rawkey(itr).flags & (uint16_t) ~MT_FLAG_DECOR_MASK);
rawkey(itr).flags = (uint16_t)(rawkey(itr).flags rawkey(itr).flags = (uint16_t)(rawkey(itr).flags
| (uint16_t)(decor_level << MT_FLAG_DECOR_OFFSET) | (uint16_t)(decor_level << MT_FLAG_DECOR_OFFSET)
| (uint16_t)(key.flags & MT_FLAG_DECOR_MASK)); | (uint16_t)(key.flags & MT_FLAG_DECOR_MASK));
@ -1111,7 +1111,7 @@ static void marktree_itr_fix_pos(MarkTree *b, MarkTreeIter *itr)
void marktree_put_test(MarkTree *b, uint32_t id, int row, int col, bool right_gravity) void marktree_put_test(MarkTree *b, uint32_t id, int row, int col, bool right_gravity)
{ {
mtkey_t key = { { row, col }, UINT32_MAX, id, 0, mtkey_t key = { { row, col }, UINT32_MAX, id, 0,
mt_flags(right_gravity, 0), 0, NULL }; mt_flags(right_gravity, 0), 0, NULL };
marktree_put(b, key, -1, -1, false); marktree_put(b, key, -1, -1, false);
} }

View File

@ -1,14 +1,14 @@
#ifndef NVIM_MARKTREE_H #ifndef NVIM_MARKTREE_H
#define NVIM_MARKTREE_H #define NVIM_MARKTREE_H
#include <stdint.h>
#include <assert.h> #include <assert.h>
#include <stdint.h>
#include "nvim/assert.h" #include "nvim/assert.h"
#include "nvim/garray.h" #include "nvim/garray.h"
#include "nvim/map.h" #include "nvim/map.h"
#include "nvim/types.h"
#include "nvim/pos.h" #include "nvim/pos.h"
#include "nvim/types.h"
#define MT_MAX_DEPTH 20 #define MT_MAX_DEPTH 20
#define MT_BRANCH_FACTOR 10 #define MT_BRANCH_FACTOR 10

View File

@ -14,7 +14,7 @@
#endif #endif
#if !defined(NAME_MAX) && defined(_XOPEN_NAME_MAX) #if !defined(NAME_MAX) && defined(_XOPEN_NAME_MAX)
#define NAME_MAX _XOPEN_NAME_MAX # define NAME_MAX _XOPEN_NAME_MAX
#endif #endif
#define BASENAMELEN (NAME_MAX - 5) #define BASENAMELEN (NAME_MAX - 5)

View File

@ -16,11 +16,11 @@
#elif defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) #elif defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__)
# include <util.h> # include <util.h>
#elif defined(__sun) #elif defined(__sun)
# include <sys/stream.h> # include <fcntl.h>
# include <sys/syscall.h> # include <signal.h>
# include <fcntl.h> # include <sys/stream.h>
# include <unistd.h> # include <sys/syscall.h>
# include <signal.h> # include <unistd.h>
#else #else
# include <pty.h> # include <pty.h>
#endif #endif
@ -49,10 +49,10 @@
// this header defines STR, just as nvim.h, but it is defined as ('S'<<8), // this header defines STR, just as nvim.h, but it is defined as ('S'<<8),
// to avoid #undef STR, #undef STR, #define STR ('S'<<8) just delay the // to avoid #undef STR, #undef STR, #define STR ('S'<<8) just delay the
// inclusion of the header even though it gets include out of order. // inclusion of the header even though it gets include out of order.
#include <sys/stropts.h> # include <sys/stropts.h>
static int openpty(int *amaster, int *aslave, char *name, static int openpty(int *amaster, int *aslave, char *name, struct termios *termp,
struct termios *termp, struct winsize *winp) struct winsize *winp)
{ {
int slave = -1; int slave = -1;
int master = open("/dev/ptmx", O_RDWR); int master = open("/dev/ptmx", O_RDWR);
@ -63,7 +63,7 @@ static int openpty(int *amaster, int *aslave, char *name,
// grantpt will invoke a setuid program to change permissions // grantpt will invoke a setuid program to change permissions
// and might fail if SIGCHLD handler is set, temporarily reset // and might fail if SIGCHLD handler is set, temporarily reset
// while running // while running
void(*sig_saved)(int) = signal(SIGCHLD, SIG_DFL); void (*sig_saved)(int) = signal(SIGCHLD, SIG_DFL);
int res = grantpt(master); int res = grantpt(master);
signal(SIGCHLD, sig_saved); signal(SIGCHLD, sig_saved);
@ -129,8 +129,7 @@ static int login_tty(int fd)
return 0; return 0;
} }
static pid_t forkpty(int *amaster, char *name, static pid_t forkpty(int *amaster, char *name, struct termios *termp, struct winsize *winp)
struct termios *termp, struct winsize *winp)
{ {
int master, slave; int master, slave;
if (openpty(&master, &slave, name, termp, winp) == -1) { if (openpty(&master, &slave, name, termp, winp) == -1) {

View File

@ -9,10 +9,10 @@
#include "nvim/ascii.h" #include "nvim/ascii.h"
#include "nvim/charset.h" #include "nvim/charset.h"
#include "nvim/eval.h"
#include "nvim/event/libuv_process.h" #include "nvim/event/libuv_process.h"
#include "nvim/event/loop.h" #include "nvim/event/loop.h"
#include "nvim/event/rstream.h" #include "nvim/event/rstream.h"
#include "nvim/eval.h"
#include "nvim/ex_cmds.h" #include "nvim/ex_cmds.h"
#include "nvim/fileio.h" #include "nvim/fileio.h"
#include "nvim/lib/kvec.h" #include "nvim/lib/kvec.h"
@ -27,8 +27,8 @@
#include "nvim/path.h" #include "nvim/path.h"
#include "nvim/screen.h" #include "nvim/screen.h"
#include "nvim/strings.h" #include "nvim/strings.h"
#include "nvim/types.h"
#include "nvim/tag.h" #include "nvim/tag.h"
#include "nvim/types.h"
#include "nvim/ui.h" #include "nvim/ui.h"
#include "nvim/vim.h" #include "nvim/vim.h"

View File

@ -5421,9 +5421,8 @@ static int vgr_process_args(exarg_T *eap, vgr_args_T *args)
/// Search for a pattern in a list of files and populate the quickfix list with /// Search for a pattern in a list of files and populate the quickfix list with
/// the matches. /// the matches.
static int vgr_process_files(win_T *wp, qf_info_T *qi, vgr_args_T *cmd_args, static int vgr_process_files(win_T *wp, qf_info_T *qi, vgr_args_T *cmd_args, bool *redraw_for_dummy,
bool *redraw_for_dummy, buf_T **first_match_buf, buf_T **first_match_buf, char_u **target_dir)
char_u **target_dir)
{ {
int status = FAIL; int status = FAIL;
unsigned save_qfid = qf_get_curlist(qi)->qf_id; unsigned save_qfid = qf_get_curlist(qi)->qf_id;

View File

@ -4680,9 +4680,9 @@ static bool use_cursor_line_sign(win_T *wp, linenr_T lnum)
// @param[in, out] sign_idxp Index of the displayed sign // @param[in, out] sign_idxp Index of the displayed sign
static void get_sign_display_info(bool nrcol, win_T *wp, linenr_T lnum, sign_attrs_T sattrs[], static void get_sign_display_info(bool nrcol, win_T *wp, linenr_T lnum, sign_attrs_T sattrs[],
int row, int startrow, int filler_lines, int filler_todo, int row, int startrow, int filler_lines, int filler_todo,
int *c_extrap, int *c_finalp, char_u *extra, int *c_extrap, int *c_finalp, char_u *extra, size_t extra_size,
size_t extra_size, char_u **pp_extra, int *n_extrap, char_u **pp_extra, int *n_extrap, int *char_attrp,
int *char_attrp, int *draw_statep, int *sign_idxp) int *draw_statep, int *sign_idxp)
{ {
int count = wp->w_scwidth; int count = wp->w_scwidth;
// Draw cells with the sign value or blank. // Draw cells with the sign value or blank.

View File

@ -13,8 +13,8 @@
#include "nvim/ascii.h" #include "nvim/ascii.h"
#include "nvim/buffer.h" #include "nvim/buffer.h"
#include "nvim/charset.h"
#include "nvim/change.h" #include "nvim/change.h"
#include "nvim/charset.h"
#include "nvim/cursor.h" #include "nvim/cursor.h"
#include "nvim/edit.h" #include "nvim/edit.h"
#include "nvim/eval.h" #include "nvim/eval.h"
@ -5048,8 +5048,8 @@ bool fuzzy_match(char_u *const str, const char_u *const pat_arg, const bool matc
int score = 0; int score = 0;
int recursionCount = 0; int recursionCount = 0;
const int matchCount const int matchCount
= fuzzy_match_recursive(pat, str, 0, &score, str, len, NULL, matches + numMatches, = fuzzy_match_recursive(pat, str, 0, &score, str, len, NULL, matches + numMatches,
maxMatches - numMatches, 0, &recursionCount); maxMatches - numMatches, 0, &recursionCount);
if (matchCount == 0) { if (matchCount == 0) {
numMatches = 0; numMatches = 0;
break; break;

View File

@ -217,9 +217,9 @@ enum { FOLD_TEXT_LEN = 51, }; //!< buffer size for get_foldtext()
#define STRLEN(s) strlen((char *)(s)) #define STRLEN(s) strlen((char *)(s))
#ifdef HAVE_STRNLEN #ifdef HAVE_STRNLEN
# define STRNLEN(s, n) strnlen((char *)(s), (size_t)(n)) # define STRNLEN(s, n) strnlen((char *)(s), (size_t)(n))
#else #else
# define STRNLEN(s, n) xstrnlen((char *)(s), (size_t)(n)) # define STRNLEN(s, n) xstrnlen((char *)(s), (size_t)(n))
#endif #endif
#define STRCPY(d, s) strcpy((char *)(d), (char *)(s)) #define STRCPY(d, s) strcpy((char *)(d), (char *)(s))
#define STRNCPY(d, s, n) strncpy((char *)(d), (char *)(s), (size_t)(n)) #define STRNCPY(d, s, n) strncpy((char *)(d), (char *)(s), (size_t)(n))