diff options
| author | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2021-11-01 01:03:08 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-31 17:03:08 -0700 |
| commit | a68faed02dc8e37b8f10da14dc02e33e6ed93947 (patch) | |
| tree | 992c62bd3451d829d4b91fef527d3f4254254bcc /src | |
| parent | 5ad15c9fa1ac6e6b2acfc2fe5e20148adeb85eb3 (diff) | |
| download | rneovim-a68faed02dc8e37b8f10da14dc02e33e6ed93947.tar.gz rneovim-a68faed02dc8e37b8f10da14dc02e33e6ed93947.tar.bz2 rneovim-a68faed02dc8e37b8f10da14dc02e33e6ed93947.zip | |
refactor: saner options for uncrustify #16196
* refactor: general good option changes
sp_deref = remove
sp_not = remove
sp_inv = remove
sp_inside_paren_cast = remove
mod_remove_duplicate_include = true
sp_after_semi = add
sp_after_semi_for = force
sp_sizeof_paren = remove
nl_return_expr = remove
nl_else_brace = remove
nl_else_if = remove
* refactor: mod_remove_extra_semicolon = true
* refactor: nl_max = 3
* refactor: sp_bool = force
* refactor: sp_compare = force
* refactor: sp_inside_paren = remove
* refactor: sp_paren_paren = remove
* refactor: sp_inside_sparen = remove
* refactor: sp_before_sparen = force
* refactor: sp_sign = remove
* refactor: sp_addr = remove
* refactor: sp_member = remove
* refactor: nl_struct_brace = remove
* refactor: nl_before_if_closing_paren = remove
* refactor: nl_fdef_brace = force
* refactor: sp_paren_comma = force
* refactor: mod_full_brace_do = add
Diffstat (limited to 'src')
60 files changed, 183 insertions, 238 deletions
diff --git a/src/nvim/api/extmark.c b/src/nvim/api/extmark.c index e6756315c6..6f1fb15dac 100644 --- a/src/nvim/api/extmark.c +++ b/src/nvim/api/extmark.c @@ -94,7 +94,6 @@ static bool ns_initialized(uint64_t ns) } - static Array extmark_to_array(ExtmarkInfo extmark, bool id, bool add_dict) { Array rv = ARRAY_DICT_INIT; @@ -504,7 +503,7 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer } #define OPTION_TO_BOOL(target, name, val) \ - target = api_object_to_bool(opts-> name, #name, val, err); \ + target = api_object_to_bool(opts->name, #name, val, err); \ if (ERROR_SET(err)) { \ goto error; \ } diff --git a/src/nvim/api/private/converter.c b/src/nvim/api/private/converter.c index 0d054c7958..36da6c13a9 100644 --- a/src/nvim/api/private/converter.c +++ b/src/nvim/api/private/converter.c @@ -5,10 +5,10 @@ #include <stddef.h> #include <stdlib.h> -#include "nvim/assert.h" +#include "nvim/api/private/converter.h" #include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" -#include "nvim/api/private/converter.h" +#include "nvim/assert.h" #include "nvim/eval/typval.h" /// Helper structure for vim_to_object diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c index 6b3f4a29d7..d470def277 100644 --- a/src/nvim/api/private/helpers.c +++ b/src/nvim/api/private/helpers.c @@ -8,6 +8,7 @@ #include <stdlib.h> #include <string.h> +#include "nvim/api/private/converter.h" #include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/api/vim.h" @@ -28,7 +29,6 @@ #include "nvim/mark.h" #include "nvim/memline.h" #include "nvim/memory.h" -#include "nvim/api/private/converter.h" #include "nvim/msgpack_rpc/helpers.h" #include "nvim/option.h" #include "nvim/option_defs.h" @@ -607,7 +607,7 @@ void modify_keymap(Buffer buffer, bool is_unmap, String mode, String lhs, String MapArguments parsed_args = MAP_ARGUMENTS_INIT; if (opts) { #define KEY_TO_BOOL(name) \ - parsed_args. name = api_object_to_bool(opts-> name, #name, false, err); \ + parsed_args.name = api_object_to_bool(opts->name, #name, false, err); \ if (ERROR_SET(err)) { \ goto fail_and_free; \ } diff --git a/src/nvim/api/vimscript.c b/src/nvim/api/vimscript.c index ac68b0eb91..c516cedaf4 100644 --- a/src/nvim/api/vimscript.c +++ b/src/nvim/api/vimscript.c @@ -5,11 +5,11 @@ #include <limits.h> #include <stdlib.h> -#include "nvim/ascii.h" -#include "nvim/api/vimscript.h" #include "nvim/api/private/converter.h" #include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" +#include "nvim/api/vimscript.h" +#include "nvim/ascii.h" #include "nvim/eval.h" #include "nvim/eval/typval.h" #include "nvim/eval/userfunc.h" diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 943d5fe6b5..a4c7b1816c 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -501,7 +501,7 @@ bool close_buffer(win_T *win, buf_T *buf, int action, bool abort_if_last) // If the buffer was in curwin and the window has changed, go back to that // window, if it still exists. This avoids that ":edit x" triggering a // "tabnext" BufUnload autocmd leaves a window behind without a buffer. - if (is_curwin && curwin != the_curwin && win_valid_any_tab(the_curwin)) { + if (is_curwin && curwin != the_curwin && win_valid_any_tab(the_curwin)) { block_autocmds(); goto_tabpage_win(the_curtab, the_curwin); unblock_autocmds(); @@ -698,7 +698,7 @@ void buf_freeall(buf_T *buf, int flags) // If the buffer was in curwin and the window has changed, go back to that // window, if it still exists. This avoids that ":edit x" triggering a // "tabnext" BufUnload autocmd leaves a window behind without a buffer. - if (is_curwin && curwin != the_curwin && win_valid_any_tab(the_curwin)) { + if (is_curwin && curwin != the_curwin && win_valid_any_tab(the_curwin)) { block_autocmds(); goto_tabpage_win(the_curtab, the_curwin); unblock_autocmds(); @@ -1042,7 +1042,6 @@ char_u *do_bufdel(int command, char_u *arg, int addr_count, int start_bnr, int e } - /* * Make the current buffer empty. * Used when it is wiped out and it's the last buffer. @@ -5172,7 +5171,6 @@ void ex_buffer_all(exarg_T *eap) } - /* * do_modelines() - process mode lines for the current file * diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 31feeb91cf..f77f0aadb0 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -147,8 +147,7 @@ struct buffheader { size_t bh_space; // space in bh_curr for appending }; -typedef struct -{ +typedef struct { buffheader_T sr_redobuff; buffheader_T sr_old_redobuff; } save_redo_T; @@ -1019,8 +1018,7 @@ typedef struct { #define MAXPOSMATCH 8 /// Same as lpos_T, but with additional field len. -typedef struct -{ +typedef struct { linenr_T lnum; ///< line number colnr_T col; ///< column number int len; ///< length: 0 - to the end of line @@ -1029,8 +1027,7 @@ typedef struct /// posmatch_T provides an array for storing match items for matchaddpos() /// function. typedef struct posmatch posmatch_T; -struct posmatch -{ +struct posmatch { llpos_T pos[MAXPOSMATCH]; ///< array of positions int cur; ///< internal position counter linenr_T toplnum; ///< top buffer line @@ -1111,8 +1108,7 @@ typedef struct { // Structure to store last cursor position and topline. Used by check_lnums() // and reset_lnums(). -typedef struct -{ +typedef struct { int w_topline_save; // original topline value int w_topline_corr; // corrected topline value pos_T w_cursor_save; // original cursor position diff --git a/src/nvim/charset.c b/src/nvim/charset.c index d2f95ad81c..8139eae131 100644 --- a/src/nvim/charset.c +++ b/src/nvim/charset.c @@ -947,7 +947,7 @@ void getvcol(win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, colnr_T *en if ((!wp->w_p_list || (wp->w_p_lcs_chars.tab1 != NUL)) && !wp->w_p_lbr && *get_showbreak_value(wp) == NUL - && !wp->w_p_bri ) { + && !wp->w_p_bri) { for (;;) { head = 0; c = *ptr; @@ -1311,7 +1311,8 @@ char_u *skiptowhite(const char_u *p) /// @param p /// /// @return Pointer to the next whitespace character. -char_u *skiptowhite_esc(char_u *p) { +char_u *skiptowhite_esc(char_u *p) +{ while (*p != ' ' && *p != '\t' && *p != NUL) { if (((*p == '\\') || (*p == Ctrl_V)) && (*(p + 1) != NUL)) { ++p; diff --git a/src/nvim/decoration.h b/src/nvim/decoration.h index 97ae9ed5d8..611b4223da 100644 --- a/src/nvim/decoration.h +++ b/src/nvim/decoration.h @@ -31,8 +31,7 @@ typedef kvec_t(VirtTextChunk) VirtText; typedef kvec_t(struct virt_line { VirtText line; bool left_col; }) VirtLines; -struct Decoration -{ +struct Decoration { VirtText virt_text; VirtLines virt_lines; diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 7c33f0cab6..6e54c0bf0e 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -1600,7 +1600,7 @@ static void diff_read(int idx_orig, int idx_new, diffout_T *dout) } } else { assert(diffstyle == DIFF_UNIFIED); - if (STRNCMP(line, "@@ ", 3) != 0) { + if (STRNCMP(line, "@@ ", 3) != 0) { continue; // not the start of a diff block } if (parse_diff_unified(line, &lnum_orig, &count_orig, @@ -3147,7 +3147,7 @@ static int xdiff_out(void *priv, mmbuffer_t *mb, int nbuf) } // sanity check - if (STRNCMP(mb[0].ptr, "@@ ", 3) != 0) { + if (STRNCMP(mb[0].ptr, "@@ ", 3) != 0) { return 0; } diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 4542576339..e2884c242b 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -3329,7 +3329,7 @@ void get_complete_info(list_T *what_list, dict_T *retdict) // Return Insert completion mode name string static char_u *ins_compl_mode(void) { - if (ctrl_x_mode == CTRL_X_NOT_DEFINED_YET || ctrl_x_mode == CTRL_X_SCROLL || compl_started) { + if (ctrl_x_mode == CTRL_X_NOT_DEFINED_YET || ctrl_x_mode == CTRL_X_SCROLL || compl_started) { return (char_u *)ctrl_x_mode_names[ctrl_x_mode & ~CTRL_X_WANT_IDENT]; } return (char_u *)""; @@ -3904,7 +3904,6 @@ static buf_T *ins_compl_next_buf(buf_T *buf, int flag) assert(wp); while ((wp = (wp->w_next != NULL ? wp->w_next : firstwin)) != curwin && wp->w_buffer->b_scanned) { - ; } buf = wp->w_buffer; } else { @@ -3917,7 +3916,6 @@ static buf_T *ins_compl_next_buf(buf_T *buf, int flag) : (!buf->b_p_bl || (buf->b_ml.ml_mfp == NULL) != (flag == 'u'))) || buf->b_scanned)) { - ; } } return buf; @@ -4427,7 +4425,7 @@ static int ins_compl_get_exp(pos_T *ini) // when ADDING, the text before the cursor matches, skip it if ((compl_cont_status & CONT_ADDING) && ins_buf == curbuf && ini->lnum == pos->lnum - && ini->col == pos->col) { + && ini->col == pos->col) { continue; } ptr = ml_get_buf(ins_buf, pos->lnum, false) + pos->col; @@ -5100,7 +5098,6 @@ static int ins_complete(int c, bool enable_pum) || ctrl_x_mode == CTRL_X_PATH_DEFINES) { if (!(compl_cont_status & CONT_ADDING)) { while (--startcol >= 0 && vim_isIDc(line[startcol])) { - ; } compl_col += ++startcol; compl_length = curs_col - startcol; @@ -5788,7 +5785,6 @@ void insertchar(int c, int flags, int second_indent) // Skip white space before the cursor i = curwin->w_cursor.col; while (--i >= 0 && ascii_iswhite(line[i])) { - ; } i++; @@ -7373,7 +7369,8 @@ void fixthisline(IndentGetter get_the_indent) } } -void fix_indent(void) { +void fix_indent(void) +{ if (p_paste) { return; } @@ -8582,7 +8579,6 @@ static void ins_mousescroll(int dir) } - static void ins_left(void) { pos_T tpos; diff --git a/src/nvim/eval.c b/src/nvim/eval.c index b31e1e81d4..19aaced7c6 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -4524,7 +4524,6 @@ static int eval_index(char_u **arg, typval_T *rettv, int evaluate, int verbose) */ key = *arg + 1; for (len = 0; ASCII_ISALNUM(key[len]) || key[len] == '_'; ++len) { - ; } if (len == 0) { return FAIL; @@ -5129,7 +5128,8 @@ failret: } /// @param ic ignore case -bool func_equal(typval_T *tv1, typval_T *tv2, bool ic) { +bool func_equal(typval_T *tv1, typval_T *tv2, bool ic) +{ char_u *s1, *s2; dict_T *d1, *d2; int a1, a2; @@ -5632,7 +5632,6 @@ bool set_ref_in_item(typval_T *tv, int copyID, ht_stack_T **ht_stack, list_stack } - /// Mark all lists and dicts referenced in given mark /// /// @returns true if setting references failed somehow. @@ -10837,7 +10836,7 @@ bool common_job_callbacks(dict_T *vopts, CallbackReader *on_stdout, CallbackRead Callback *on_exit) { if (tv_dict_get_callback(vopts, S_LEN("on_stdout"), &on_stdout->cb) - &&tv_dict_get_callback(vopts, S_LEN("on_stderr"), &on_stderr->cb) + && tv_dict_get_callback(vopts, S_LEN("on_stderr"), &on_stderr->cb) && tv_dict_get_callback(vopts, S_LEN("on_exit"), on_exit)) { on_stdout->buffered = tv_dict_get_number(vopts, "stdout_buffered"); on_stderr->buffered = tv_dict_get_number(vopts, "stderr_buffered"); diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 29f7d22317..eb7d62d7a2 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -738,7 +738,8 @@ static void buf_win_common(typval_T *argvars, typval_T *rettv, bool get_nr) } /// "bufwinid(nr)" function -static void f_bufwinid(typval_T *argvars, typval_T *rettv, FunPtr fptr) { +static void f_bufwinid(typval_T *argvars, typval_T *rettv, FunPtr fptr) +{ buf_win_common(argvars, rettv, false); } @@ -1812,7 +1813,7 @@ static void f_deletebufline(typval_T *argvars, typval_T *rettv, FunPtr fptr) if (wp->w_buffer == buf) { if (wp->w_cursor.lnum > last) { wp->w_cursor.lnum -= count; - } else if (wp->w_cursor.lnum> first) { + } else if (wp->w_cursor.lnum > first) { wp->w_cursor.lnum = first; } if (wp->w_cursor.lnum > wp->w_buffer->b_ml.ml_line_count) { @@ -4620,10 +4621,9 @@ static bool has_wsl(void) static TriState has_wsl = kNone; if (has_wsl == kNone) { Error err = ERROR_INIT; - Object o = nlua_exec( - STATIC_CSTR_AS_STRING("return vim.loop.os_uname()['release']:lower()" - ":match('microsoft') and true or false"), - (Array)ARRAY_DICT_INIT, &err); + Object o = nlua_exec(STATIC_CSTR_AS_STRING("return vim.loop.os_uname()['release']:lower()" + ":match('microsoft') and true or false"), + (Array)ARRAY_DICT_INIT, &err); assert(!ERROR_SET(&err)); assert(o.type == kObjectTypeBoolean); has_wsl = o.data.boolean ? kTrue : kFalse; @@ -11245,7 +11245,6 @@ static void f_tabpagenr(typval_T *argvars, typval_T *rettv, FunPtr fptr) } - /* * Common code for tabpagewinnr() and winnr(). */ diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index 4e845cffdd..811a1d40dd 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -3162,7 +3162,7 @@ int tv_check_for_nonempty_string(const typval_T *const tv) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_PURE { if (tv_check_for_string(tv) == FAIL) { - return FAIL; + return FAIL; } if (tv->vval.v_string == NULL || *tv->vval.v_string == NUL) { EMSG(_(e_non_empty_string_required)); diff --git a/src/nvim/eval/typval.h b/src/nvim/eval/typval.h index 994bce899d..843f879ed0 100644 --- a/src/nvim/eval/typval.h +++ b/src/nvim/eval/typval.h @@ -831,7 +831,7 @@ extern bool tv_in_free_unref_items; /// @param li Name of the variable with current listitem_T entry. /// @param code Cycle body. #define TV_LIST_ITER(l, li, code) \ - _TV_LIST_ITER_MOD(, l, li, code) + _TV_LIST_ITER_MOD( , l, li, code) /// Iterate over a list /// diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c index 3c7532df7b..6a01cbba5c 100644 --- a/src/nvim/eval/userfunc.c +++ b/src/nvim/eval/userfunc.c @@ -2349,7 +2349,7 @@ void ex_function(exarg_T *eap) // heredoc: Check for ":python <<EOF", ":lua <<EOF", etc. arg = skipwhite(skiptowhite(p)); - if (arg[0] == '<' && arg[1] =='<' + if (arg[0] == '<' && arg[1] == '<' && ((p[0] == 'p' && p[1] == 'y' && (!ASCII_ISALNUM(p[2]) || p[2] == 't' || ((p[2] == '3' || p[2] == 'x') @@ -2383,7 +2383,7 @@ void ex_function(exarg_T *eap) arg = skipwhite(skiptowhite(arg)); if (arg[0] == '=' && arg[1] == '<' - && arg[2] =='<' + && arg[2] == '<' && (p[0] == 'l' && p[1] == 'e' && (!ASCII_ISALNUM(p[2]) diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 17ab138d75..8db1f984ba 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -14,8 +14,8 @@ #include <string.h> #include "nvim/api/buffer.h" -#include "nvim/api/private/defs.h" #include "nvim/api/extmark.h" +#include "nvim/api/private/defs.h" #include "nvim/ascii.h" #include "nvim/buffer.h" #include "nvim/buffer_updates.h" @@ -303,8 +303,9 @@ void ex_align(exarg_T *eap) * Now try to move the line as much as possible to * the right. Stop when it moves too far. */ - do + do{ (void)set_indent(++new_indent, 0); + } while (linelen(NULL) <= width); --new_indent; break; @@ -1859,11 +1860,11 @@ int do_write(exarg_T *eap) /* * Not writing the whole file is only allowed with '!'. */ - if ( (eap->line1 != 1 - || eap->line2 != curbuf->b_ml.ml_line_count) - && !eap->forceit - && !eap->append - && !p_wa) { + if ((eap->line1 != 1 + || eap->line2 != curbuf->b_ml.ml_line_count) + && !eap->forceit + && !eap->append + && !p_wa) { if (p_confirm || cmdmod.confirm) { if (vim_dialog_yesno(VIM_QUESTION, NULL, (char_u *)_("Write partial file?"), 2) != VIM_YES) { @@ -3135,7 +3136,6 @@ void ex_z(exarg_T *eap) // the number of '-' and '+' multiplies the distance if (*kind == '-' || *kind == '+') { for (x = kind + 1; *x == *kind; ++x) { - ; } } @@ -4409,7 +4409,7 @@ skip: if (got_quit || profile_passed_limit(timeout)) { // Too slow, disable. set_string_option_direct("icm", -1, (char_u *)"", OPT_FREE, SID_NONE); - } else if (*p_icm != NUL && pat != NULL) { + } else if (*p_icm != NUL && pat != NULL) { if (pre_src_id == 0) { // Get a unique new src_id, saved in a static pre_src_id = (int)nvim_create_namespace((String)STRING_INIT); @@ -4724,7 +4724,6 @@ bool prepare_tagpreview(bool undo_sync) } - /* * ":help": open a read-only window on a help file */ @@ -5175,7 +5174,7 @@ int find_help_tags(const char_u *arg, int *num_matches, char_u ***matches, bool // If tag contains "({" or "([", tag terminates at the "(". // This is for help on functions, e.g.: abs({expr}). - if (*s == '(' && (s[1] == '{' || s[1] =='[')) { + if (*s == '(' && (s[1] == '{' || s[1] == '[')) { break; } diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index e169514e79..1dd37c0471 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -550,7 +550,6 @@ bool check_changed(buf_T *buf, int flags) } |