Merge pull request #17663 from dundargoc/refactor/uncrustify

refactor: apply uncrustify
This commit is contained in:
bfredl
2022-03-11 15:07:49 +01:00
committed by GitHub
28 changed files with 155 additions and 158 deletions

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

@@ -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

@@ -7066,10 +7066,12 @@ static void init_srand(uint32_t *const x)
if (dev_urandom_state != OK) { if (dev_urandom_state != OK) {
// Reading /dev/urandom doesn't work, fall back to time(). // Reading /dev/urandom doesn't work, fall back to time().
#endif #endif
// uncrustify:off
*x = time(NULL); *x = time(NULL);
#ifndef MSWIN #ifndef MSWIN
} }
#endif #endif
// uncrustify:on
} }
static inline uint32_t splitmix32(uint32_t *const x) static inline uint32_t splitmix32(uint32_t *const x)

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

@@ -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

@@ -3,6 +3,8 @@
// fileio.c: read from and write to a file // fileio.c: read from and write to a file
// uncrustify:off
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>

View File

@@ -820,7 +820,7 @@ 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; \
} }
@@ -907,7 +907,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"
@@ -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;

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"

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"

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));

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 <fcntl.h>
# include <signal.h>
# include <sys/stream.h> # include <sys/stream.h>
# include <sys/syscall.h> # include <sys/syscall.h>
# include <fcntl.h>
# include <unistd.h> # include <unistd.h>
# include <signal.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

@@ -4578,9 +4578,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"