refactor: format with uncrustify #15872

* refactor: format with uncrustify
* refactor: fix function parameter comments
This commit is contained in:
dundargoc 2021-10-02 23:41:50 +02:00 committed by GitHub
parent 09307e64df
commit 8c74c895b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 1243 additions and 1168 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2,14 +2,14 @@
// 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 <assert.h> #include <assert.h>
#include <limits.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <limits.h>
#include "nvim/assert.h" #include "nvim/assert.h"
#include "nvim/vim.h"
#include "nvim/ui.h"
#include "nvim/ugrid.h" #include "nvim/ugrid.h"
#include "nvim/ui.h"
#include "nvim/vim.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS #ifdef INCLUDE_GENERATED_DECLARATIONS
# include "ugrid.c.generated.h" # include "ugrid.c.generated.h"
@ -79,8 +79,7 @@ void ugrid_scroll(UGrid *grid, int top, int bot, int left, int right, int count)
} }
} }
static void clear_region(UGrid *grid, int top, int bot, int left, int right, static void clear_region(UGrid *grid, int top, int bot, int left, int right, sattr_T attr)
sattr_T attr)
{ {
for (int row = top; row <= bot; row++) { for (int row = top; row <= bot; row++) {
UGRID_FOREACH_CELL(grid, row, left, right+1, { UGRID_FOREACH_CELL(grid, row, left, right+1, {

View File

@ -3,40 +3,40 @@
#include <assert.h> #include <assert.h>
#include <inttypes.h> #include <inttypes.h>
#include <limits.h>
#include <stdbool.h> #include <stdbool.h>
#include <string.h> #include <string.h>
#include <limits.h>
#include "nvim/vim.h" #include "nvim/ascii.h"
#include "nvim/log.h"
#include "nvim/aucmd.h" #include "nvim/aucmd.h"
#include "nvim/ui.h"
#include "nvim/charset.h" #include "nvim/charset.h"
#include "nvim/cursor.h" #include "nvim/cursor.h"
#include "nvim/cursor_shape.h"
#include "nvim/diff.h" #include "nvim/diff.h"
#include "nvim/event/loop.h"
#include "nvim/ex_cmds2.h" #include "nvim/ex_cmds2.h"
#include "nvim/ex_getln.h" #include "nvim/ex_getln.h"
#include "nvim/fold.h" #include "nvim/fold.h"
#include "nvim/main.h"
#include "nvim/ascii.h"
#include "nvim/misc1.h"
#include "nvim/mbyte.h"
#include "nvim/garray.h" #include "nvim/garray.h"
#include "nvim/highlight.h"
#include "nvim/log.h"
#include "nvim/main.h"
#include "nvim/mbyte.h"
#include "nvim/memory.h" #include "nvim/memory.h"
#include "nvim/misc1.h"
#include "nvim/move.h" #include "nvim/move.h"
#include "nvim/normal.h" #include "nvim/normal.h"
#include "nvim/option.h" #include "nvim/option.h"
#include "nvim/os_unix.h"
#include "nvim/event/loop.h"
#include "nvim/os/time.h"
#include "nvim/os/input.h" #include "nvim/os/input.h"
#include "nvim/os/signal.h" #include "nvim/os/signal.h"
#include "nvim/os/time.h"
#include "nvim/os_unix.h"
#include "nvim/popupmnu.h" #include "nvim/popupmnu.h"
#include "nvim/screen.h" #include "nvim/screen.h"
#include "nvim/highlight.h" #include "nvim/ui.h"
#include "nvim/ui_compositor.h" #include "nvim/ui_compositor.h"
#include "nvim/vim.h"
#include "nvim/window.h" #include "nvim/window.h"
#include "nvim/cursor_shape.h"
#ifdef FEAT_TUI #ifdef FEAT_TUI
# include "nvim/tui/tui.h" # include "nvim/tui/tui.h"
#else #else
@ -70,9 +70,9 @@ static int pending_has_mouse = -1;
static size_t uilog_seen = 0; static size_t uilog_seen = 0;
static char uilog_last_event[1024] = { 0 }; static char uilog_last_event[1024] = { 0 };
#ifndef EXITFREE # ifndef EXITFREE
#define entered_free_all_mem false # define entered_free_all_mem false
#endif # endif
# define UI_LOG(funname) \ # define UI_LOG(funname) \
do { \ do { \
@ -95,7 +95,7 @@ static char uilog_last_event[1024] = { 0 };
// UI_CALL invokes a function on all registered UI instances. // UI_CALL invokes a function on all registered UI instances.
// This is called by code generated by generators/gen_api_ui_events.lua // This is called by code generated by generators/gen_api_ui_events.lua
// C code should use ui_call_{funname} instead. // C code should use ui_call_{funname} instead.
# define UI_CALL(cond, funname, ...) \ #define UI_CALL(cond, funname, ...) \
do { \ do { \
bool any_call = false; \ bool any_call = false; \
for (size_t i = 0; i < ui_count; i++) { \ for (size_t i = 0; i < ui_count; i++) { \
@ -115,7 +115,7 @@ static char uilog_last_event[1024] = { 0 };
#endif #endif
#ifndef EXITFREE #ifndef EXITFREE
#undef entered_free_all_mem # undef entered_free_all_mem
#endif #endif
void ui_init(void) void ui_init(void)
@ -382,8 +382,8 @@ void ui_set_ext_option(UI *ui, UIExtension ext, bool active)
} }
} }
void ui_line(ScreenGrid *grid, int row, int startcol, int endcol, int clearcol, void ui_line(ScreenGrid *grid, int row, int startcol, int endcol, int clearcol, int clearattr,
int clearattr, bool wrap) bool wrap)
{ {
assert(0 <= row && row < grid->Rows); assert(0 <= row && row < grid->Rows);
LineFlags flags = wrap ? kLineFlagWrap : 0; LineFlags flags = wrap ? kLineFlagWrap : 0;

View File

@ -5,18 +5,18 @@
// Used by the built-in TUI and libnvim-based UIs. // Used by the built-in TUI and libnvim-based UIs.
#include <assert.h> #include <assert.h>
#include <limits.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <limits.h>
#include "nvim/api/private/helpers.h"
#include "nvim/log.h" #include "nvim/log.h"
#include "nvim/main.h" #include "nvim/main.h"
#include "nvim/vim.h"
#include "nvim/ui.h"
#include "nvim/memory.h" #include "nvim/memory.h"
#include "nvim/ui_bridge.h"
#include "nvim/ugrid.h" #include "nvim/ugrid.h"
#include "nvim/api/private/helpers.h" #include "nvim/ui.h"
#include "nvim/ui_bridge.h"
#include "nvim/vim.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS #ifdef INCLUDE_GENERATED_DECLARATIONS
# include "ui_bridge.c.generated.h" # include "ui_bridge.c.generated.h"
@ -26,8 +26,7 @@
// Schedule a function call on the UI bridge thread. // Schedule a function call on the UI bridge thread.
#define UI_BRIDGE_CALL(ui, name, argc, ...) \ #define UI_BRIDGE_CALL(ui, name, argc, ...) \
((UIBridgeData *)ui)->scheduler( \ ((UIBridgeData *)ui)->scheduler(event_create(ui_bridge_##name##_event, argc, __VA_ARGS__), UI(ui))
event_create(ui_bridge_##name##_event, argc, __VA_ARGS__), UI(ui))
#define INT2PTR(i) ((void *)(intptr_t)i) #define INT2PTR(i) ((void *)(intptr_t)i)
#define PTR2INT(p) ((Integer)(intptr_t)p) #define PTR2INT(p) ((Integer)(intptr_t)p)
@ -138,8 +137,8 @@ static void ui_bridge_stop_event(void **argv)
ui->stop(ui); ui->stop(ui);
} }
static void ui_bridge_hl_attr_define(UI *ui, Integer id, HlAttrs attrs, static void ui_bridge_hl_attr_define(UI *ui, Integer id, HlAttrs attrs, HlAttrs cterm_attrs,
HlAttrs cterm_attrs, Array info) Array info)
{ {
HlAttrs *a = xmalloc(sizeof(HlAttrs)); HlAttrs *a = xmalloc(sizeof(HlAttrs));
*a = attrs; *a = attrs;
@ -163,11 +162,9 @@ static void ui_bridge_raw_line_event(void **argv)
xfree(argv[8]); xfree(argv[8]);
xfree(argv[9]); xfree(argv[9]);
} }
static void ui_bridge_raw_line(UI *ui, Integer grid, Integer row, static void ui_bridge_raw_line(UI *ui, Integer grid, Integer row, Integer startcol, Integer endcol,
Integer startcol, Integer endcol, Integer clearcol, Integer clearattr, LineFlags flags,
Integer clearcol, Integer clearattr, const schar_T *chunk, const sattr_T *attrs)
LineFlags flags, const schar_T *chunk,
const sattr_T *attrs)
{ {
size_t ncol = (size_t)(endcol-startcol); size_t ncol = (size_t)(endcol-startcol);
schar_T *c = xmemdup(chunk, ncol * sizeof(schar_T)); schar_T *c = xmemdup(chunk, ncol * sizeof(schar_T));

View File

@ -7,27 +7,27 @@
// Layer-based compositing: https://en.wikipedia.org/wiki/Digital_compositing // Layer-based compositing: https://en.wikipedia.org/wiki/Digital_compositing
#include <assert.h> #include <assert.h>
#include <limits.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <limits.h>
#include "nvim/api/private/helpers.h"
#include "nvim/ascii.h"
#include "nvim/highlight.h"
#include "nvim/lib/kvec.h" #include "nvim/lib/kvec.h"
#include "nvim/log.h" #include "nvim/log.h"
#include "nvim/lua/executor.h"
#include "nvim/main.h" #include "nvim/main.h"
#include "nvim/ascii.h"
#include "nvim/vim.h"
#include "nvim/ui.h"
#include "nvim/highlight.h"
#include "nvim/memory.h" #include "nvim/memory.h"
#include "nvim/message.h" #include "nvim/message.h"
#include "nvim/os/os.h"
#include "nvim/popupmnu.h" #include "nvim/popupmnu.h"
#include "nvim/ui_compositor.h"
#include "nvim/ugrid.h"
#include "nvim/screen.h" #include "nvim/screen.h"
#include "nvim/syntax.h" #include "nvim/syntax.h"
#include "nvim/api/private/helpers.h" #include "nvim/ugrid.h"
#include "nvim/lua/executor.h" #include "nvim/ui.h"
#include "nvim/os/os.h" #include "nvim/ui_compositor.h"
#include "nvim/vim.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS #ifdef INCLUDE_GENERATED_DECLARATIONS
# include "ui_compositor.c.generated.h" # include "ui_compositor.c.generated.h"
@ -123,8 +123,8 @@ bool ui_comp_should_draw(void)
/// TODO(bfredl): later on the compositor should just use win_float_pos events, /// TODO(bfredl): later on the compositor should just use win_float_pos events,
/// though that will require slight event order adjustment: emit the win_pos /// though that will require slight event order adjustment: emit the win_pos
/// events in the beginning of update_screen(0), rather than in ui_flush() /// events in the beginning of update_screen(0), rather than in ui_flush()
bool ui_comp_put_grid(ScreenGrid *grid, int row, int col, int height, int width, bool ui_comp_put_grid(ScreenGrid *grid, int row, int col, int height, int width, bool valid,
bool valid, bool on_top) bool on_top)
{ {
bool moved; bool moved;
@ -257,8 +257,7 @@ static void ui_comp_raise_grid(ScreenGrid *grid, size_t new_index)
} }
} }
static void ui_comp_grid_cursor_goto(UI *ui, Integer grid_handle, static void ui_comp_grid_cursor_goto(UI *ui, Integer grid_handle, Integer r, Integer c)
Integer r, Integer c)
{ {
if (!ui_comp_should_draw() || !ui_comp_set_grid((int)grid_handle)) { if (!ui_comp_should_draw() || !ui_comp_set_grid((int)grid_handle)) {
return; return;
@ -304,8 +303,7 @@ ScreenGrid *ui_comp_mouse_focus(int row, int col)
/// Baseline implementation. This is always correct, but we can sometimes /// Baseline implementation. This is always correct, but we can sometimes
/// do something more efficient (where efficiency means smaller deltas to /// do something more efficient (where efficiency means smaller deltas to
/// the downstream UI.) /// the downstream UI.)
static void compose_line(Integer row, Integer startcol, Integer endcol, static void compose_line(Integer row, Integer startcol, Integer endcol, LineFlags flags)
LineFlags flags)
{ {
// If rightleft is set, startcol may be -1. In such cases, the assertions // If rightleft is set, startcol may be -1. In such cases, the assertions
// will fail because no overlap is found. Adjust startcol to prevent it. // will fail because no overlap is found. Adjust startcol to prevent it.
@ -447,8 +445,8 @@ static void compose_line(Integer row, Integer startcol, Integer endcol,
(const sattr_T *)attrbuf+skipstart); (const sattr_T *)attrbuf+skipstart);
} }
static void compose_debug(Integer startrow, Integer endrow, Integer startcol, static void compose_debug(Integer startrow, Integer endrow, Integer startcol, Integer endcol,
Integer endcol, int syn_id, bool delay) int syn_id, bool delay)
{ {
if (!(rdb_flags & RDB_COMPOSITOR)) { if (!(rdb_flags & RDB_COMPOSITOR)) {
return; return;
@ -479,8 +477,7 @@ static void debug_delay(Integer lines)
} }
static void compose_area(Integer startrow, Integer endrow, static void compose_area(Integer startrow, Integer endrow, Integer startcol, Integer endcol)
Integer startcol, Integer endcol)
{ {
compose_debug(startrow, endrow, startcol, endcol, dbghl_recompose, true); compose_debug(startrow, endrow, startcol, endcol, dbghl_recompose, true);
endrow = MIN(endrow, default_grid.Rows); endrow = MIN(endrow, default_grid.Rows);
@ -505,11 +502,9 @@ void ui_comp_compose_grid(ScreenGrid *grid)
} }
} }
static void ui_comp_raw_line(UI *ui, Integer grid, Integer row, static void ui_comp_raw_line(UI *ui, Integer grid, Integer row, Integer startcol, Integer endcol,
Integer startcol, Integer endcol, Integer clearcol, Integer clearattr, LineFlags flags,
Integer clearcol, Integer clearattr, const schar_T *chunk, const sattr_T *attrs)
LineFlags flags, const schar_T *chunk,
const sattr_T *attrs)
{ {
if (!ui_comp_should_draw() || !ui_comp_set_grid((int)grid)) { if (!ui_comp_should_draw() || !ui_comp_set_grid((int)grid)) {
return; return;
@ -529,11 +524,11 @@ static void ui_comp_raw_line(UI *ui, Integer grid, Integer row,
// when resizing nvim, a window will be attempted to be drawn on the older // when resizing nvim, a window will be attempted to be drawn on the older
// and possibly larger global screen size. // and possibly larger global screen size.
if (row >= default_grid.Rows) { if (row >= default_grid.Rows) {
DLOG("compositor: invalid row %"PRId64" on grid %"PRId64, row, grid); DLOG("compositor: invalid row %" PRId64 " on grid %" PRId64, row, grid);
return; return;
} }
if (clearcol > default_grid.Columns) { if (clearcol > default_grid.Columns) {
DLOG("compositor: invalid last column %"PRId64" on grid %"PRId64, DLOG("compositor: invalid last column %" PRId64 " on grid %" PRId64,
clearcol, grid); clearcol, grid);
if (startcol >= default_grid.Columns) { if (startcol >= default_grid.Columns) {
return; return;
@ -572,8 +567,8 @@ void ui_comp_set_screen_valid(bool valid)
} }
} }
static void ui_comp_msg_set_pos(UI *ui, Integer grid, Integer row, static void ui_comp_msg_set_pos(UI *ui, Integer grid, Integer row, Boolean scrolled,
Boolean scrolled, String sep_char) String sep_char)
{ {
msg_grid.comp_row = (int)row; msg_grid.comp_row = (int)row;
if (scrolled && row > 0) { if (scrolled && row > 0) {
@ -617,9 +612,8 @@ static bool curgrid_covered_above(int row)
return kv_size(layers)-(above_msg?1:0) > curgrid->comp_index+1; return kv_size(layers)-(above_msg?1:0) > curgrid->comp_index+1;
} }
static void ui_comp_grid_scroll(UI *ui, Integer grid, Integer top, static void ui_comp_grid_scroll(UI *ui, Integer grid, Integer top, Integer bot, Integer left,
Integer bot, Integer left, Integer right, Integer right, Integer rows, Integer cols)
Integer rows, Integer cols)
{ {
if (!ui_comp_should_draw() || !ui_comp_set_grid((int)grid)) { if (!ui_comp_should_draw() || !ui_comp_set_grid((int)grid)) {
return; return;
@ -653,8 +647,7 @@ static void ui_comp_grid_scroll(UI *ui, Integer grid, Integer top,
} }
} }
static void ui_comp_grid_resize(UI *ui, Integer grid, static void ui_comp_grid_resize(UI *ui, Integer grid, Integer width, Integer height)
Integer width, Integer height)
{ {
if (grid == 1) { if (grid == 1) {
ui_composed_call_grid_resize(1, width, height); ui_composed_call_grid_resize(1, width, height);

File diff suppressed because it is too large Load Diff

View File

@ -6,32 +6,32 @@
/// Nvim was forked from Vim 7.4.160. /// Nvim was forked from Vim 7.4.160.
/// Vim originated from Stevie version 3.6 (Fish disk 217) by GRWalter (Fred). /// Vim originated from Stevie version 3.6 (Fish disk 217) by GRWalter (Fred).
#include <inttypes.h>
#include <assert.h> #include <assert.h>
#include <inttypes.h>
#include <limits.h> #include <limits.h>
#include "nvim/api/private/helpers.h" #include "nvim/api/private/helpers.h"
#include "nvim/vim.h"
#include "nvim/ascii.h" #include "nvim/ascii.h"
#include "nvim/buffer.h" #include "nvim/buffer.h"
#include "nvim/iconv.h"
#include "nvim/version.h"
#include "nvim/charset.h" #include "nvim/charset.h"
#include "nvim/iconv.h"
#include "nvim/lua/executor.h"
#include "nvim/memline.h" #include "nvim/memline.h"
#include "nvim/memory.h" #include "nvim/memory.h"
#include "nvim/message.h" #include "nvim/message.h"
#include "nvim/screen.h" #include "nvim/screen.h"
#include "nvim/strings.h" #include "nvim/strings.h"
#include "nvim/lua/executor.h" #include "nvim/version.h"
#include "nvim/vim.h"
// version info generated by the build system // version info generated by the build system
#include "auto/versiondef.h" #include "auto/versiondef.h"
// for ":version", ":intro", and "nvim --version" // for ":version", ":intro", and "nvim --version"
#ifndef NVIM_VERSION_MEDIUM #ifndef NVIM_VERSION_MEDIUM
#define NVIM_VERSION_MEDIUM "v" STR(NVIM_VERSION_MAJOR)\ # define NVIM_VERSION_MEDIUM "v" STR(NVIM_VERSION_MAJOR)\
"." STR(NVIM_VERSION_MINOR) "." STR(NVIM_VERSION_PATCH)\ "." STR(NVIM_VERSION_MINOR) "." STR(NVIM_VERSION_PATCH)\
NVIM_VERSION_PRERELEASE NVIM_VERSION_PRERELEASE
#endif #endif
#define NVIM_VERSION_LONG "NVIM " NVIM_VERSION_MEDIUM #define NVIM_VERSION_LONG "NVIM " NVIM_VERSION_MEDIUM
@ -50,23 +50,23 @@ char *version_cflags = "Compilation: " NVIM_VERSION_CFLAGS;
static char *features[] = { static char *features[] = {
#ifdef HAVE_ACL #ifdef HAVE_ACL
"+acl", "+acl",
#else #else
"-acl", "-acl",
#endif #endif
#if defined(HAVE_ICONV) #if defined(HAVE_ICONV)
"+iconv", "+iconv",
#else #else
"-iconv", "-iconv",
#endif #endif
#ifdef FEAT_TUI #ifdef FEAT_TUI
"+tui", "+tui",
#else #else
"-tui", "-tui",
#endif #endif
NULL NULL
}; };
// clang-format off // clang-format off

View File

@ -1,4 +1,4 @@
# Uncrustify-0.73.0-186-03faf73c5 # Uncrustify-0.73.0-195-1f883c691
# #
# General options # General options
@ -535,14 +535,21 @@ sp_inside_braces_struct = ignore # ignore/add/remove/force/not_defined
sp_inside_braces_oc_dict = ignore # ignore/add/remove/force/not_defined sp_inside_braces_oc_dict = ignore # ignore/add/remove/force/not_defined
# Add or remove space after open brace in an unnamed temporary # Add or remove space after open brace in an unnamed temporary
# direct-list-initialization. # direct-list-initialization
# if statement is a brace_init_lst
# works only if sp_brace_brace is set to ignore.
sp_after_type_brace_init_lst_open = ignore # ignore/add/remove/force/not_defined sp_after_type_brace_init_lst_open = ignore # ignore/add/remove/force/not_defined
# Add or remove space before close brace in an unnamed temporary # Add or remove space before close brace in an unnamed temporary
# direct-list-initialization. # direct-list-initialization
# if statement is a brace_init_lst
# works only if sp_brace_brace is set to ignore.
sp_before_type_brace_init_lst_close = ignore # ignore/add/remove/force/not_defined sp_before_type_brace_init_lst_close = ignore # ignore/add/remove/force/not_defined
# Add or remove space inside an unnamed temporary direct-list-initialization. # Add or remove space inside an unnamed temporary direct-list-initialization
# if statement is a brace_init_lst
# works only if sp_brace_brace is set to ignore
# works only if sp_before_type_brace_init_lst_close is set to ignore.
sp_inside_type_brace_init_lst = ignore # ignore/add/remove/force/not_defined sp_inside_type_brace_init_lst = ignore # ignore/add/remove/force/not_defined
# Add or remove space inside '{' and '}'. # Add or remove space inside '{' and '}'.