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
This commit is contained in:
dundargoc 2021-11-01 01:03:08 +01:00 committed by GitHub
parent 5ad15c9fa1
commit a68faed02d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
60 changed files with 183 additions and 238 deletions

View File

@ -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; \
}

View File

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

View File

@ -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; \
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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().
*/

View File

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

View File

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

View File

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

View File

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

View File

@ -550,7 +550,6 @@ bool check_changed(buf_T *buf, int flags)
}
/// Ask the user what to do when abandoning a changed buffer.
/// Must check 'write' option first!
///

View File

@ -5697,7 +5697,8 @@ void ex_comclear(exarg_T *eap)
uc_clear(&curbuf->b_ucmds);
}
static void free_ucmd(ucmd_T *cmd) {
static void free_ucmd(ucmd_T *cmd)
{
xfree(cmd->uc_name);
xfree(cmd->uc_rep);
xfree(cmd->uc_compl_arg);
@ -7207,8 +7208,7 @@ void ex_splitview(exarg_T *eap)
*eap->cmd == 'v' ? WSP_VERT : 0) != FAIL) {
// Reset 'scrollbind' when editing another file, but keep it when
// doing ":split" without arguments.
if (*eap->arg != NUL
) {
if (*eap->arg != NUL) {
RESET_BINDING(curwin);
} else {
do_check_scrollbind(false);
@ -7369,7 +7369,6 @@ static void ex_resize(exarg_T *eap)
if (eap->addr_count > 0) {
n = eap->line2;
for (wp = firstwin; wp->w_next != NULL && --n > 0; wp = wp->w_next) {
;
}
}
@ -7562,7 +7561,6 @@ static void ex_nogui(exarg_T *eap)
}
static void ex_swapname(exarg_T *eap)
{
if (curbuf->b_ml.ml_mfp == NULL || curbuf->b_ml.ml_mfp->mf_fname == NULL) {
@ -8054,8 +8052,7 @@ static void ex_operators(exarg_T *eap)
default: // CMD_rshift or CMD_lshift
if (
(eap->cmdidx == CMD_rshift) ^ curwin->w_p_rl
) {
(eap->cmdidx == CMD_rshift) ^ curwin->w_p_rl) {
oa.op_type = OP_RSHIFT;
} else {
oa.op_type = OP_LSHIFT;

View File

@ -1628,8 +1628,9 @@ void ex_endtry(exarg_T *eap)
eap->errmsg = get_end_emsg(cstack);
// Find the matching ":try" and report what's missing.
idx = cstack->cs_idx;
do
do{
--idx;
}
while (idx > 0 && !(cstack->cs_flags[idx] & CSF_TRY));
rewind_conditionals(cstack, idx, CSF_WHILE | CSF_FOR,
&cstack->cs_looplevel);

View File

@ -2036,7 +2036,6 @@ static int command_line_handle_key(CommandLineState *s)
return command_line_not_changed(s);
case K_SELECT: // end of Select mode mapping - ignore
return command_line_not_changed(s);
@ -2462,7 +2461,8 @@ char *getcmdline_prompt(const char firstc, const char *const prompt, const int a
* Return TRUE when the text must not be changed and we can't switch to
* another window or buffer. Used when editing the command line etc.
*/
int text_locked(void) {
int text_locked(void)
{
if (cmdwin_type != 0) {
return TRUE;
}
@ -2478,7 +2478,8 @@ void text_locked_msg(void)
EMSG(_(get_text_locked_msg()));
}
char_u *get_text_locked_msg(void) {
char_u *get_text_locked_msg(void)
{
if (cmdwin_type != 0) {
return e_cmdwin;
} else {
@ -5606,7 +5607,6 @@ void globpath(char_u *path, char_u *file, garray_T *ga, int expand_options)
}
/*********************************
* Command line history stuff *
*********************************/

View File

@ -48,7 +48,8 @@
# include "extmark.c.generated.h"
#endif
static ExtmarkNs *buf_ns_ref(buf_T *buf, uint64_t ns_id, bool put) {
static ExtmarkNs *buf_ns_ref(buf_T *buf, uint64_t ns_id, bool put)
{
return map_ref(uint64_t, ExtmarkNs)(buf->b_extmark_ns, ns_id, put);
}

View File

@ -8,8 +8,7 @@
EXTERN int extmark_splice_pending INIT(= 0);
typedef struct
{
typedef struct {
uint64_t ns_id;
uint64_t mark_id;
int row;

View File

@ -12,8 +12,7 @@ typedef struct {
} VirtTextChunk;
typedef struct
{
typedef struct {
uint64_t ns_id;
uint64_t mark_id;
// TODO(bfredl): a lot of small allocations. Should probably use

View File

@ -832,7 +832,6 @@ retry:
}
#ifdef HAVE_ICONV
// Try using iconv() if we can't convert internally.
if (fio_flags == 0
@ -1519,7 +1518,6 @@ rewind_retry:
try_mac = 1;
try_unix = 1;
for (; p >= ptr && *p != CAR; p--) {
;
}
if (p >= ptr) {
for (p = ptr; p < ptr + size; ++p) {
@ -3083,7 +3081,6 @@ nobackup:
}
if (converted && wb_flags == 0) {
#ifdef HAVE_ICONV
// Use iconv() conversion when conversion is needed and it's not done
@ -4250,7 +4247,6 @@ static int get_fio_flags(const char_u *name)
}
/*
* Check for a Unicode BOM (Byte Order Mark) at the start of p[size].
* "size" must be at least 2.
@ -5436,7 +5432,6 @@ char_u *vim_tempname(void)
}
/// Tries matching a filename with a "pattern" ("prog" is NULL), or use the
/// precompiled regprog "prog" ("pattern" is NULL). That avoids calling
/// vim_regcomp() often.

View File

@ -1560,8 +1560,7 @@ int vgetc(void)
buf[0] = (char_u)c;
for (i = 1; i < n; i++) {
buf[i] = (char_u)vgetorpeek(true);
if (buf[i] == K_SPECIAL
) {
if (buf[i] == K_SPECIAL) {
// Must be a K_SPECIAL - KS_SPECIAL - KE_FILLER sequence,
// which represents a K_SPECIAL (0x80),
// or a CSI - KS_EXTRA - KE_CSI sequence, which represents

View File

@ -1463,7 +1463,6 @@ retry:
// If the line's too long for the buffer, discard it.
if ((p = strchr(buf, '\n')) == NULL) {
while ((ch = getc(csinfo[cnumber].fr_fp)) != EOF && ch != '\n') {
;
}
return NULL;
}
@ -1521,7 +1520,7 @@ static void cs_file_results(FILE *f, int *nummatches_a)
context = xmalloc(strlen(cntx) + 5);
if (strcmp(cntx, "<global>")==0) {
if (strcmp(cntx, "<global>") == 0) {
strcpy(context, "<<global>>");
} else {
sprintf(context, "<<%s>>", cntx);

View File

@ -95,15 +95,15 @@
} while (0)
#define kv_splice(v1, v0) \
do { \
if ((v1).capacity < (v1).size + (v0).size) { \
(v1).capacity = (v1).size + (v0).size; \
kv_roundup32((v1).capacity); \
kv_resize((v1), (v1).capacity); \
} \
memcpy((v1).items + (v1).size, (v0).items, sizeof((v1).items[0]) * (v0).size); \
(v1).size = (v1).size + (v0).size; \
} while (0)
do { \
if ((v1).capacity < (v1).size + (v0).size) { \
(v1).capacity = (v1).size + (v0).size; \
kv_roundup32((v1).capacity); \
kv_resize((v1), (v1).capacity); \
} \
memcpy((v1).items + (v1).size, (v0).items, sizeof((v1).items[0]) * (v0).size); \
(v1).size = (v1).size + (v0).size; \
} while (0)
#define kv_pushp(v) \
((((v).size == (v).capacity) ? (kv_resize_full(v), 0) : 0), \

View File

@ -38,7 +38,7 @@ typedef struct _queue {
// elements results in undefined behavior.
#define QUEUE_FOREACH(q, h, code) \
(q) = (h)->next; \
while((q) != (h)) { \
while ((q) != (h)) { \
QUEUE *next = q->next; \
code \
(q) = next; \

View File

@ -229,7 +229,7 @@ static int nlua_str_utf_start(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL
const char *s1 = luaL_checklstring(lstate, 1, &s1_len);
long offset = luaL_checkinteger(lstate, 2);
if (offset < 0 || offset > (intptr_t)s1_len) {
return luaL_error(lstate, "index out of range");
return luaL_error(lstate, "index out of range");
}
int tail_offset = mb_head_off((char_u *)s1, (char_u *)s1 + (char_u)offset - 1);
lua_pushinteger(lstate, tail_offset);
@ -249,7 +249,7 @@ static int nlua_str_utf_end(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL
const char *s1 = luaL_checklstring(lstate, 1, &s1_len);
long offset = luaL_checkinteger(lstate, 2);
if (offset < 0 || offset > (intptr_t)s1_len) {
return luaL_error(lstate, "index out of range");
return luaL_error(lstate, "index out of range");
}
int tail_offset = mb_tail_off((char_u *)s1, (char_u *)s1 + (char_u)offset - 1);
lua_pushinteger(lstate, tail_offset);
@ -311,7 +311,8 @@ int nlua_regex(lua_State *lstate)
return 1;
}
static dict_T *nlua_get_var_scope(lua_State *lstate) {
static dict_T *nlua_get_var_scope(lua_State *lstate)
{
const char *scope = luaL_checkstring(lstate, 1);
handle_T handle = (handle_T)luaL_checkinteger(lstate, 2);
dict_T *dict = NULL;
@ -463,7 +464,6 @@ static int nlua_stricmp(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL
}
void nlua_state_add_stdlib(lua_State *const lstate)
{
// stricmp

View File

@ -1195,7 +1195,8 @@ int tslua_parse_query(lua_State *L)
}
static const char *query_err_string(TSQueryError err) {
static const char *query_err_string(TSQueryError err)
{
switch (err) {
case TSQueryErrorSyntax:
return "invalid syntax";

View File

@ -674,8 +674,7 @@ void getout(int exitval)
profile_dump();
if (did_emsg
) {
if (did_emsg) {
// give the user a chance to read the (error) message
no_wait_return = FALSE;
wait_return(FALSE);

View File

@ -346,7 +346,6 @@ static int enc_canon_search(const char_u *name)
}
/*
* Find canonical encoding "name" in the list and return its properties.
* Returns 0 if not found.
@ -2432,8 +2431,6 @@ static char_u *iconv_string(const vimconv_T *const vcp, char_u *str, size_t slen
#endif // HAVE_ICONV
/*
* Setup "vcp" for conversion from "from" to "to".
* The names must have been made canonical with enc_canonize().

View File

@ -1638,7 +1638,7 @@ static time_t swapfile_unchanged(char *fname)
}
// the ID and magic number must be correct
if (ml_check_b0_id(&b0) == FAIL|| b0_magic_wrong(&b0)) {
if (ml_check_b0_id(&b0) == FAIL || b0_magic_wrong(&b0)) {
ret = false;
}
@ -2563,8 +2563,7 @@ static int ml_delete_int(buf_T *buf, linenr_T lnum, bool message)
* If the file becomes empty the last line is replaced by an empty line.
*/
if (buf->b_ml.ml_line_count == 1) { // file becomes empty
if (message
) {
if (message) {
set_keep_msg((char_u *)_(no_lines_msg), 0);
}

View File

@ -38,8 +38,6 @@
#endif
/// The character for each menu mode
static char_u menu_mode_chars[] = { 'n', 'v', 's', 'o', 'i', 'c', 't' };
@ -951,7 +949,7 @@ char_u *set_context_in_menu_cmd(expand_T *xp, const char *cmd, char_u *arg, bool
if (!ascii_iswhite(*p)) {
if (STRNCMP(arg, "enable", 6) == 0
&& (arg[6] == NUL || ascii_iswhite(arg[6]))) {
&& (arg[6] == NUL || ascii_iswhite(arg[6]))) {
p = arg + 6;
} else if (STRNCMP(arg, "disable", 7) == 0
&& (arg[7] == NUL || ascii_iswhite(arg[7]))) {

View File

@ -1199,11 +1199,11 @@ void wait_return(int redraw)
}
} while ((had_got_int && c == Ctrl_C)
|| c == K_IGNORE
|| c == K_LEFTDRAG || c == K_LEFTRELEASE
|| c == K_LEFTDRAG || c == K_LEFTRELEASE
|| c == K_MIDDLEDRAG || c == K_MIDDLERELEASE
|| c == K_RIGHTDRAG || c == K_RIGHTRELEASE
|| c == K_MOUSELEFT || c == K_MOUSERIGHT
|| c == K_MOUSEDOWN || c == K_MOUSEUP
|| c == K_RIGHTDRAG || c == K_RIGHTRELEASE
|| c == K_MOUSELEFT || c == K_MOUSERIGHT
|| c == K_MOUSEDOWN || c == K_MOUSEUP
|| c == K_MOUSEMOVE);
os_breakcheck();
/*

View File

@ -145,7 +145,6 @@ int get_leader_len(char_u *line, char_u **flags, bool backward, bool include_spa
}
}
for (j = 0; string[j] != NUL && string[j] == line[i + j]; ++j) {
;
}
if (string[j] != NUL) {
continue; // string doesn't match
@ -276,7 +275,7 @@ int get_last_leader_offset(char_u *line, char_u **flags)
}
}
for (j = 0; string[j] != NUL && string[j] == line[i + j]; ++j) {
/* do nothing */;
// do nothing
}
if (string[j] != NUL) {
continue;

View File

@ -4772,7 +4772,6 @@ dozet:
}
/*
* "Q" command.
*/
@ -5780,10 +5779,10 @@ static void nv_brackets(cmdarg_T *cap)
* "[m" or "]m" search for prev/next start of (Java) method.
* "[M" or "]M" search for prev/next end of (Java) method.
*/
if ( (cap->cmdchar == '['
&& vim_strchr((char_u *)"{(*/#mM", cap->nchar) != NULL)
|| (cap->cmdchar == ']'
&& vim_strchr((char_u *)"})*/#mM", cap->nchar) != NULL)) {
if ((cap->cmdchar == '['
&& vim_strchr((char_u *)"{(*/#mM", cap->nchar) != NULL)
|| (cap->cmdchar == ']'
&& vim_strchr((char_u *)"})*/#mM", cap->nchar) != NULL)) {
if (cap->nchar == '*') {
cap->nchar = '/';
}

View File

@ -1787,7 +1787,7 @@ int op_replace(oparg_T *oap, int c)
char_u *after_p = NULL;
int had_ctrl_v_cr = false;
if ((curbuf->b_ml.ml_flags & ML_EMPTY ) || oap->empty) {
if ((curbuf->b_ml.ml_flags & ML_EMPTY) || oap->empty) {
return OK; // nothing to do
}
if (c == REPLACE_CR_NCHAR) {
@ -4141,7 +4141,6 @@ static int same_leader(linenr_T lnum, int leader1_len, char_u *leader1_flags, in
*/
line1 = vim_strsave(ml_get(lnum));
for (idx1 = 0; ascii_iswhite(line1[idx1]); ++idx1) {
;
}
line2 = ml_get(lnum + 1);
for (idx2 = 0; idx2 < leader2_len; ++idx2) {

View File

@ -419,7 +419,7 @@ void set_init_1(bool clean_arg)
}
xfree(item);
}
if(mustfree) {
if (mustfree) {
xfree(p);
}
}
@ -2932,7 +2932,7 @@ ambw_end:
// When changing the 'signcolumn' to or from 'number', recompute the
// width of the number column if 'number' or 'relativenumber' is set.
if (((*oldval == 'n' && *(oldval + 1) == 'u')
|| (*curwin->w_p_scl == 'n' && *(curwin->w_p_scl + 1) =='u'))
|| (*curwin->w_p_scl == 'n' && *(curwin->w_p_scl + 1) == 'u'))
&& (curwin->w_p_nu || curwin->w_p_rnu)) {
curwin->w_nrwidth_line_count = 0;
}
@ -7330,7 +7330,7 @@ bool tabstop_set(char_u *var, long **array)
t = 1;
for (cp = var; *cp != NUL;) {
(*array)[t++] = atoi((char *)cp);
while (*cp != NUL && *cp != ',') {
while (*cp != NUL && *cp != ',') {
cp++;
}
if (*cp != NUL) {

View File

@ -401,7 +401,7 @@ static InbufPollResult inbuf_poll(int ms, MultiQueue *events)
prof_inchar_enter();
}
if ((ms == - 1 || ms > 0) && events != main_loop.events && !input_eof) {
if ((ms == -1 || ms > 0) && events != main_loop.events && !input_eof) {
// The pending input provoked a blocking wait. Do special events now. #6247
blocking = true;
multiqueue_process_events(ch_before_blocking_events);

View File

@ -96,7 +96,7 @@ conpty_t *os_conpty_init(char **in_name, char **out_name, uint16_t width, uint16
goto failed;
}
assert(width <= SHRT_MAX);
assert(height <= SHRT_MAX);
assert(height <= SHRT_MAX);
COORD size = { (int16_t)width, (int16_t)height };
HRESULT hr;
hr = pCreatePseudoConsole(size, in_read, out_write, 0, &conpty_object->pty);
@ -107,7 +107,7 @@ conpty_t *os_conpty_init(char **in_name, char **out_name, uint16_t width, uint16
conpty_object->si_ex.StartupInfo.cb = sizeof(conpty_object->si_ex);
size_t bytes_required;
InitializeProcThreadAttributeList(NULL, 1, 0, & bytes_required);
InitializeProcThreadAttributeList(NULL, 1, 0, &bytes_required);
conpty_object->si_ex.lpAttributeList =
(PPROC_THREAD_ATTRIBUTE_LIST)xmalloc(bytes_required);
if (!InitializeProcThreadAttributeList(conpty_object->si_ex.lpAttributeList,

View File

@ -1011,8 +1011,7 @@ static void uniquefy_paths(garray_T *gap, char_u *pattern)
// /file.txt / /file.txt
// c:\file.txt c:\ .\file.txt
short_name = path_shorten_fname(path, curdir);
if (short_name != NULL && short_name > path + 1
) {
if (short_name != NULL && short_name > path + 1) {
STRCPY(path, ".");
add_pathsep((char *)path);
STRMOVE(path + STRLEN(path), short_name);
@ -1506,8 +1505,9 @@ void simplify_filename(char_u *filename)
if (vim_ispathsep(*p)) {
relative = false;
do
do{
++p;
}
while (vim_ispathsep(*p));
}
start = p; // remember start after "c:/" or "/" or "///"

View File

@ -322,8 +322,7 @@ int qf_init(win_T *wp, const char_u *restrict efile, char_u *restrict errorforma
// Maximum number of bytes allowed per line while reading an errorfile.
static const size_t LINE_MAXLEN = 4096;
static struct fmtpattern
{
static struct fmtpattern {
char_u convchar;
char *pattern;
} fmt_pat[FMT_PATTERNS] =
@ -2379,7 +2378,7 @@ static qfline_T *get_nth_valid_entry(qf_list_T *qfl, int errornr, int dir, int *
static qfline_T *get_nth_entry(qf_list_T *qfl, int errornr, int *new_qfidx)
{
qfline_T *qf_ptr = qfl->qf_ptr;
int qf_idx = qfl->qf_index;;
int qf_idx = qfl->qf_index;
// New error number is less than the current error number
while (errornr < qf_idx && qf_idx > 1 && qf_ptr->qf_prev != NULL) {
@ -7168,4 +7167,3 @@ void ex_helpgrep(exarg_T *eap)
}
}

View File

@ -574,7 +574,6 @@ void runtime_search_path_validate(void)
}
/// Just like do_in_path_and_pp(), using 'runtimepath' for "path".
int do_in_runtimepath(char_u *name, int flags, DoInRuntimepathCB callback, void *cookie)
{

View File

@ -65,8 +65,8 @@
#include <stdbool.h>
#include <string.h>
#include "nvim/api/private/helpers.h"
#include "nvim/api/extmark.h"
#include "nvim/api/private/helpers.h"
#include "nvim/api/vim.h"
#include "nvim/arabic.h"
#include "nvim/ascii.h"
@ -1952,7 +1952,7 @@ static size_t fill_foldcolumn(char_u *p, win_T *wp, foldinfo_T foldinfo, linenr_
first_level = 1;
}
for (i = 0; i < MIN(fdc, level); i++) {
for (i = 0; i < MIN(fdc, level); i++) {
if (foldinfo.fi_lnum == lnum
&& first_level + i >= foldinfo.fi_low_level) {
symbol = wp->w_p_fcs_chars.foldopen;
@ -6081,7 +6081,7 @@ static void prepare_search_hl(win_T *wp, linenr_T lnum)
|| (cur != NULL && pos_inprogress))) {
next_search_hl(wp, shl, shl->first_lnum, (colnr_T)n,
shl == &search_hl ? NULL : cur);
pos_inprogress = !(cur == NULL || cur->pos.cur == 0);
pos_inprogress = !(cur == NULL || cur->pos.cur == 0);
if (shl->lnum != 0) {
shl->first_lnum = shl->lnum
+ shl->rm.endpos[0].lnum
@ -6725,7 +6725,6 @@ bool grid_invalid_row(ScreenGrid *grid, int row)
}
/// Copy part of a grid line for vertically split window.
static void linecopy(ScreenGrid *grid, int to, int from, int col, int width)
{

View File

@ -2530,13 +2530,14 @@ int findsent(Direction dir, long count)
}
if (c == '.' || c == '!' || c == '?') {
tpos = pos;
do
do{
if ((c = inc(&tpos)) == -1) {
break;
}
}
while (vim_strchr((char_u *)")]\"'", c = gchar_pos(&tpos))
!= NULL);
if (c == -1 || (!cpo_J && (c == ' ' || c == '\t')) || c == NUL
if (c == -1 || (!cpo_J && (c == ' ' || c == '\t')) || c == NUL
|| (cpo_J && (c == ' ' && inc(&tpos) >= 0
&& gchar_pos(&tpos) == ' '))) {
pos = tpos;
@ -2662,12 +2663,12 @@ static int inmacro(char_u *opt, char_u *s)
// Accept two characters in the option being equal to two characters
// in the line. A space in the option matches with a space in the
// line or the line having ended.
if ( (macro[0] == s[0]
|| (macro[0] == ' '
&& (s[0] == NUL || s[0] == ' ')))
&& (macro[1] == s[1]
|| ((macro[1] == NUL || macro[1] == ' ')
&& (s[0] == NUL || s[1] == NUL || s[1] == ' ')))) {
if ((macro[0] == s[0]
|| (macro[0] == ' '
&& (s[0] == NUL || s[0] == ' ')))
&& (macro[1] == s[1]
|| ((macro[1] == NUL || macro[1] == ' ')
&& (s[0] == NUL || s[1] == NUL || s[1] == ' ')))) {
break;
}
++macro;
@ -4250,7 +4251,6 @@ abort_search:
}
/// Find next search match under cursor, cursor at end.
/// Used while an operator is pending, and in Visual mode.
///
@ -4934,10 +4934,8 @@ void find_pattern_in_path(char_u *ptr, Direction dir, size_t len, bool whole, bo
// find the file name after the end of the match
for (p = incl_regmatch.endp[0];
*p && !vim_isfilec(*p); p++) {
;
}
for (i = 0; vim_isfilec(p[i]); i++) {
;
}
}

View File

@ -84,8 +84,7 @@ typedef struct {
int sa_wrapped; ///< search wrapped around
} searchit_arg_T;
typedef struct searchstat
{
typedef struct searchstat {
int cur; // current position of found words
int cnt; // total count of found words
bool exact_match; // true if matched exactly on specified position

View File

@ -23,8 +23,7 @@
/// Struct to hold the sign properties.
typedef struct sign sign_T;
struct sign
{
struct sign {
sign_T *sn_next; // next sign in list
int sn_typenr; // type number of sign
char_u *sn_name; // name of sign
@ -434,9 +433,9 @@ sign_attrs_T *sign_get_attr(SignType type, sign_attrs_T sattrs[], int idx, int m
int nr_matches = 0;
for (int i = 0; i < SIGN_SHOW_MAX; i++) {
if ( (type == SIGN_TEXT && sattrs[i].sat_text != NULL)
|| (type == SIGN_LINEHL && sattrs[i].sat_linehl != 0)
|| (type == SIGN_NUMHL && sattrs[i].sat_numhl != 0)) {
if ((type == SIGN_TEXT && sattrs[i].sat_text != NULL)
|| (type == SIGN_LINEHL && sattrs[i].sat_linehl != 0)
|| (type == SIGN_NUMHL && sattrs[i].sat_numhl != 0)) {
matches[nr_matches] = &sattrs[i];
nr_matches++;
// attr list is sorted with most important (priority, id), thus we

View File

@ -9,8 +9,7 @@
// signs: line annotations
// Sign group
typedef struct signgroup_S
{
typedef struct signgroup_S {
uint16_t sg_refcount; // number of signs in this group
int sg_next_sign_id; // next sign id for this group
char_u sg_name[1]; // sign group name
@ -55,5 +54,4 @@ typedef enum {
} SignType;
#endif // NVIM_SIGN_DEFS_H

View File

@ -1758,7 +1758,8 @@ void slang_free(slang_T *lp)
}
/// Frees a salitem_T
static void free_salitem(salitem_T *smp) {
static void free_salitem(salitem_T *smp)
{
xfree(smp->sm_lead);
// Don't free sm_oneof and sm_rules, they point into sm_lead.
xfree(smp->sm_to);
@ -1768,7 +1769,8 @@ static void free_salitem(salitem_T *smp) {
}
/// Frees a fromto_T
static void free_fromto(fromto_T *ftp) {
static void free_fromto(fromto_T *ftp)
{
xfree(ftp->ft_from);
xfree(ftp->ft_to);
}
@ -3420,7 +3422,6 @@ static void spell_suggest_file(suginfo_T *su, char_u *fname)
if (STRICMP(su->su_badword, line) == 0) {
// Match! Isolate the good word, until CR or NL.
for (len = 0; p[len] >= ' '; ++len) {
;
}
p[len] = NUL;
@ -3813,7 +3814,6 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
if (sp->ts_prefixdepth == PFD_PREFIXTREE) {
// Skip over the NUL bytes, we use them later.
for (n = 0; n < len && byts[arridx + n] == 0; ++n) {
;
}
sp->ts_curi += n;
@ -3888,7 +3888,6 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
n = stack[sp->ts_prefixdepth].ts_arridx;
len = pbyts[n++];
for (c = 0; c < len && pbyts[n + c] == 0; ++c) {
;
}
if (c > 0) {
c = valid_word_prefix(c, n, flags,

View File

@ -549,7 +549,7 @@ static inline int spell_check_magic_string(FILE *const fd)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_ALWAYS_INLINE
{
char buf[VIMSPELLMAGICL];
SPELL_READ_BYTES(buf, VIMSPELLMAGICL, fd, ;);
SPELL_READ_BYTES(buf, VIMSPELLMAGICL, fd, ; );
if (memcmp(buf, VIMSPELLMAGIC, VIMSPELLMAGICL) != 0) {
return SP_FORMERROR;
}
@ -1030,7 +1030,7 @@ static int read_region_section(FILE *fd, slang_T *lp, int len)
if (len > MAXREGIONS * 2) {
return SP_FORMERROR;
}
SPELL_READ_NONNUL_BYTES((char *)lp->sl_regions, (size_t)len, fd, ;);
SPELL_READ_NONNUL_BYTES((char *)lp->sl_regions, (size_t)len, fd, ; );
lp->sl_regions[len] = NUL;
return 0;
}
@ -1097,7 +1097,7 @@ static int read_prefcond_section(FILE *fd, slang_T *lp)
if (n > 0) {
char buf[MAXWLEN + 1];
buf[0] = '^'; // always match at one position only
SPELL_READ_NONNUL_BYTES(buf + 1, (size_t)n, fd, ;);
SPELL_READ_NONNUL_BYTES(buf + 1, (size_t)n, fd, ; );
buf[n + 1] = NUL;
lp->sl_prefprog[i] = vim_regcomp((char_u *)buf, RE_MAGIC | RE_STRING);
}
@ -5164,13 +5164,13 @@ static int offset2bytes(int nr, char_u *buf)
buf[3] = b1;
return 4;
}
if (b3 > 1 || b2 > 0x3f ) { // 3 bytes
if (b3 > 1 || b2 > 0x3f) { // 3 bytes
buf[0] = 0xc0 + b3;
buf[1] = b2;
buf[2] = b1;
return 3;
}
if (b2 > 1 || b1 > 0x7f ) { // 2 bytes
if (b2 > 1 || b1 > 0x7f) { // 2 bytes
buf[0] = 0x80 + b2;
buf[1] = b1;
return 2;

View File

@ -1184,7 +1184,7 @@ int vim_vsnprintf_typval(char *str, size_t str_m, const char *fmt, va_list ap, t
zero_padding_insertion_ind++;
}
if (zero_padding_insertion_ind + 1 < str_arg_l
&& tmp[zero_padding_insertion_ind] == '0'
&& tmp[zero_padding_insertion_ind] == '0'
&& (tmp[zero_padding_insertion_ind + 1] == 'x'
|| tmp[zero_padding_insertion_ind + 1] == 'X'
|| tmp[zero_padding_insertion_ind + 1] == 'b'

View File

@ -1082,7 +1082,6 @@ static void syn_stack_alloc(void)
// Make sure that all valid entries fit in the new array.
while (syn_block->b_sst_len - syn_block->b_sst_freecount + 2 > len
&& syn_stack_cleanup()) {
;
}
if (len < syn_block->b_sst_len - syn_block->b_sst_freecount + 2) {
len = syn_block->b_sst_len - syn_block->b_sst_freecount + 2;
@ -7771,8 +7770,6 @@ int syn_id2attr(int hl_id)
}
/*
* Translate a group ID to the final group ID (following links).
*/

View File

@ -1066,7 +1066,6 @@ void do_tags(exarg_T *eap)
}
/*
* Compare two strings, for length "len", ignoring case the ASCII way.
* return 0 for match, < 0 for smaller, > 0 for bigger
@ -1757,7 +1756,6 @@ line_read_in:
}
/*
* When still at the start of the file, check for Emacs tags file
* format, and for "not sorted" flag.

View File

@ -725,7 +725,7 @@ void terminal_get_line_attributes(Terminal *term, win_T *wp, int linenr, int *te
int attr_id = 0;
if (hl_attrs ||!fg_default || !bg_default) {
if (hl_attrs || !fg_default || !bg_default) {
attr_id = hl_get_term_attr(&(HlAttrs) {
.cterm_ae_attr = (int16_t)hl_attrs,
.cterm_fg_color = vt_fg_idx,

View File

@ -135,7 +135,8 @@ static int seen_b_u_curhead;
static int seen_b_u_newhead;
static int header_count;
static void u_check_tree(u_header_T *uhp, u_header_T *exp_uh_next, u_header_T *exp_uh_alt_prev) {
static void u_check_tree(u_header_T *uhp, u_header_T *exp_uh_next, u_header_T *exp_uh_alt_prev)
{
u_entry_T *uep;
if (uhp == NULL) {
@ -182,7 +183,8 @@ static void u_check_tree(u_header_T *uhp, u_header_T *exp_uh_next, u_header_T *e
}
}
static void u_check(int newhead_may_be_NULL) {
static void u_check(int newhead_may_be_NULL)
{
seen_b_u_newhead = 0;
seen_b_u_curhead = 0;
header_count = 0;

View File

@ -1992,7 +1992,8 @@ bool has_vim_patch(int n)
return false;
}
Dictionary version_dict(void) {
Dictionary version_dict(void)
{
Dictionary d = ARRAY_DICT_INIT;
PUT(d, "major", INTEGER_OBJ(NVIM_VERSION_MAJOR));
PUT(d, "minor", INTEGER_OBJ(NVIM_VERSION_MINOR));

View File

@ -164,8 +164,6 @@ enum {
};
// Minimal size for block 0 of a swap file.
// NOTE: This depends on size of struct block0! It's not done with a sizeof(),
// because struct block0 is defined in memline.c (Sorry).
@ -175,7 +173,6 @@ enum {
#define MAX_SWAP_PAGE_SIZE 50000
// Boolean constants
#ifndef TRUE

View File

@ -59,8 +59,6 @@
#endif
#define NOWIN (win_T *)-1 // non-existing window
#define ROWS_AVAIL (Rows - p_ch - tabline_height())
@ -1773,7 +1771,6 @@ static void win_rotate(bool upwards, int count)
// find last frame and append removed window/frame after it
for (; frp->fr_next != NULL; frp = frp->fr_next) {
;
}
win_append(frp->fr_win, wp1);
frame_append(frp, wp1->w_frame);
@ -1783,7 +1780,6 @@ static void win_rotate(bool upwards, int count)
// find last window/frame in the list and remove it
for (frp = curwin->w_frame; frp->fr_next != NULL;
frp = frp->fr_next) {
;
}
wp1 = frp->fr_win;
wp2 = wp1->w_prev; // will become last window
@ -2707,7 +2703,6 @@ void win_close_othertab(win_T *win, int free_buf, tabpage_T *tp)
// Careful: Autocommands may have closed the tab page or made it the
// current tab page.
for (ptp = first_tabpage; ptp != NULL && ptp != tp; ptp = ptp->tp_next) {
;
}
if (ptp == NULL || tp == curtab) {
return;
@ -3045,7 +3040,6 @@ static tabpage_T *alt_tabpage(void)
// Find the last but one tab page.
for (tp = first_tabpage; tp->tp_next != curtab; tp = tp->tp_next) {
;
}
return tp;
}
@ -3150,12 +3144,14 @@ static void frame_new_height(frame_T *topfrp, int height, bool topfirst, bool wf
break;
}
if (topfirst) {
do
do{
frp = frp->fr_next;
}
while (wfh && frp != NULL && frame_fixed_height(frp));
} else {
do
do{
frp = frp->fr_prev;
}
while (wfh && frp != NULL && frame_fixed_height(frp));
}
// Increase "height" if we could not reduce enough frames.
@ -3348,12 +3344,14 @@ static void frame_new_width(frame_T *topfrp, int width, bool leftfirst, bool wfw
break;
}
if (leftfirst) {
do
do{
frp = frp->fr_next;
}
while (wfw && frp != NULL && frame_fixed_width(frp));
} else {
do
do{
frp = frp->fr_prev;
}
while (wfw && frp != NULL && frame_fixed_width(frp));
}
// Increase "width" if we could not reduce enough frames.
@ -4120,14 +4118,12 @@ void goto_tabpage(int n)
for (i = n; i < 0; ++i) {
for (tp = first_tabpage; tp->tp_next != ttp && tp->tp_next != NULL;
tp = tp->tp_next) {
;
}
ttp = tp;
}
} else if (n == 9999) {
// Go to last tab page.
for (tp = first_tabpage; tp->tp_next != NULL; tp = tp->tp_next) {
;
}
} else {
// Go to tab page "n".
@ -5006,7 +5002,6 @@ void do_autocmd_winscrolled(win_T *wp)
* Save the size of all windows in "gap".
*/
void win_size_save(garray_T *gap)
{
ga_init(gap, (int)sizeof(int), 1);
ga_grow(gap, win_count() * 2 + 1);
@ -6300,7 +6295,6 @@ static void last_status_rec(frame_T *fr, bool statusline)
} else {
// horizontally split window, set status line for last one
for (fp = fr->fr_child; fp->fr_next != NULL; fp = fp->fr_next) {
;
}
last_status_rec(fp, statusline);
}
@ -7160,7 +7154,8 @@ void win_ui_flush(void)
}
}
win_T *lastwin_nofloating(void) {
win_T *lastwin_nofloating(void)
{
win_T *res = lastwin;
while (res->w_floating) {
res = res->w_prev;

View File

@ -160,16 +160,16 @@ sp_pp_stringify = ignore # ignore/add/remove/force/not_defined
sp_before_pp_stringify = ignore # ignore/add/remove/force/not_defined
# Add or remove space around boolean operators '&&' and '||'.
sp_bool = ignore # ignore/add/remove/force/not_defined
sp_bool = force # ignore/add/remove/force/not_defined
# Add or remove space around compare operator '<', '>', '==', etc.
sp_compare = ignore # ignore/add/remove/force/not_defined
sp_compare = force # ignore/add/remove/force/not_defined
# Add or remove space inside '(' and ')'.
sp_inside_paren = ignore # ignore/add/remove/force/not_defined
sp_inside_paren = remove # ignore/add/remove/force/not_defined
# Add or remove space between nested parentheses, i.e. '((' vs. ') )'.
sp_paren_paren = ignore # ignore/add/remove/force/not_defined
sp_paren_paren = remove # ignore/add/remove/force/not_defined
# Add or remove space between back-to-back parentheses, i.e. ')(' vs. ') ('.
sp_cparen_oparen = ignore # ignore/add/remove/force/not_defined
@ -301,7 +301,7 @@ sp_angle_word = ignore # ignore/add/remove/force/not_defined
# Add or remove space between '>' and '>' in '>>' (template stuff).
#
# Default: add
sp_angle_shift = ignore # ignore/add/remove/force/not_defined
sp_angle_shift = add # ignore/add/remove/force/not_defined
# (C++11) Permit removal of the space between '>>' in 'foo<bar<int> >'. Note
# that sp_angle_shift cannot remove the space without this option.
@ -309,10 +309,10 @@ sp_permit_cpp11_shift = false # true/false
# Add or remove space before '(' of control statements ('if', 'for', 'switch',
# 'while', etc.).
sp_before_sparen = ignore # ignore/add/remove/force/not_defined
sp_before_sparen = force # ignore/add/remove/force/not_defined
# Add or remove space inside '(' and ')' of control statements.
sp_inside_sparen = ignore # ignore/add/remove/force/not_defined
sp_inside_sparen = remove # ignore/add/remove/force/not_defined
# Add or remove space after '(' of control statements.
#
@ -370,12 +370,12 @@ sp_between_semi_for_empty = ignore # ignore/add/remove/force/not_defined
# Add or remove space after ';', except when followed by a comment.
#
# Default: add
sp_after_semi = ignore # ignore/add/remove/force/not_defined
sp_after_semi = add # ignore/add/remove/force/not_defined
# Add or remove space after ';' in non-empty 'for' statements.
#
# Default: force
sp_after_semi_for = ignore # ignore/add/remove/force/not_defined
sp_after_semi_for = force # ignore/add/remove/force/not_defined
# Add or remove space after the final semicolon of an empty part of a for
# statement, as in 'for ( ; ; <here> )'.
@ -387,7 +387,7 @@ sp_before_square = ignore # ignore/add/remove/force/not_defined
# Add or remove space before '[' for a variable definition.
#
# Default: remove
sp_before_vardef_square = ignore # ignore/add/remove/force/not_defined
sp_before_vardef_square = remove # ignore/add/remove/force/not_defined
# Add or remove space before '[' for asm block.
sp_before_square_asm_block = ignore # ignore/add/remove/force/not_defined
@ -432,7 +432,7 @@ sp_between_mdatype_commas = ignore # ignore/add/remove/force/not_defined
# i.e. '(,' vs. '( ,'.
#
# Default: force
sp_paren_comma = ignore # ignore/add/remove/force/not_defined
sp_paren_comma = force # ignore/add/remove/force/not_defined
# Add or remove space after the variadic '...' when preceded by a
# non-punctuator.
@ -474,12 +474,12 @@ sp_before_class_colon = ignore # ignore/add/remove/force/not_defined
# Add or remove space after class constructor ':'.
#
# Default: add
sp_after_constr_colon = ignore # ignore/add/remove/force/not_defined
sp_after_constr_colon = add # ignore/add/remove/force/not_defined
# Add or remove space before class constructor ':'.
#
# Default: add
sp_before_constr_colon = ignore # ignore/add/remove/force/not_defined
sp_before_constr_colon = add # ignore/add/remove/force/not_defined
# Add or remove space before case ':'.
#
@ -502,14 +502,14 @@ sp_after_operator_sym_empty = ignore # ignore/add/remove/force/not_defined
sp_after_cast = remove # ignore/add/remove/force/not_defined
# Add or remove spaces inside cast parentheses.
sp_inside_paren_cast = ignore # ignore/add/remove/force/not_defined
sp_inside_paren_cast = remove # ignore/add/remove/force/not_defined
# Add or remove space between the type and open parenthesis in a C++ cast,
# i.e. 'int(exp)' vs. 'int (exp)'.
sp_cpp_cast_paren = ignore # ignore/add/remove/force/not_defined
# Add or remove space between 'sizeof' and '('.
sp_sizeof_paren = ignore # ignore/add/remove/force/not_defined
sp_sizeof_paren = remove # ignore/add/remove/force/not_defined
# Add or remove space between 'sizeof' and '...'.
sp_sizeof_ellipsis = ignore # ignore/add/remove/force/not_defined
@ -694,12 +694,12 @@ sp_scope_paren = ignore # ignore/add/remove/force/not_defined
# Add or remove space between 'super' and '(' in 'super (something)'.
#
# Default: remove
sp_super_paren = ignore # ignore/add/remove/force/not_defined
sp_super_paren = remove # ignore/add/remove/force/not_defined
# Add or remove space between 'this' and '(' in 'this (something)'.
#
# Default: remove
sp_this_paren = ignore # ignore/add/remove/force/not_defined
sp_this_paren = remove # ignore/add/remove/force/not_defined
# Add or remove space between a macro name and its definition.
sp_macro = ignore # ignore/add/remove/force/not_defined
@ -751,7 +751,7 @@ sp_word_brace_init_lst = ignore # ignore/add/remove/force/not_defined
# Add or remove space between a variable and '{' for a namespace.
#
# Default: add
sp_word_brace_ns = ignore # ignore/add/remove/force/not_defined
sp_word_brace_ns = add # ignore/add/remove/force/not_defined
# Add or remove space before the '::' operator.
sp_before_dc = ignore # ignore/add/remove/force/not_defined
@ -765,34 +765,34 @@ sp_d_array_colon = ignore # ignore/add/remove/force/not_defined
# Add or remove space after the '!' (not) unary operator.
#
# Default: remove
sp_not = ignore # ignore/add/remove/force/not_defined
sp_not = remove # ignore/add/remove/force/not_defined
# Add or remove space after the '~' (invert) unary operator.
#
# Default: remove
sp_inv = ignore # ignore/add/remove/force/not_defined
sp_inv = remove # ignore/add/remove/force/not_defined
# Add or remove space after the '&' (address-of) unary operator. This does not
# affect the spacing after a '&' that is part of a type.
#
# Default: remove
sp_addr = ignore # ignore/add/remove/force/not_defined
sp_addr = remove # ignore/add/remove/force/not_defined
# Add or remove space around the '.' or '->' operators.
#
# Default: remove
sp_member = ignore # ignore/add/remove/force/not_defined
sp_member = remove # ignore/add/remove/force/not_defined
# Add or remove space after the '*' (dereference) unary operator. This does
# not affect the spacing after a '*' that is part of a type.
#
# Default: remove
sp_deref = ignore # ignore/add/remove/force/not_defined
sp_deref = remove # ignore/add/remove/force/not_defined
# Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7'.
#
# Default: remove
sp_sign = ignore # ignore/add/remove/force/not_defined
sp_sign = remove # ignore/add/remove/force/not_defined
# Add or remove space between '++' and '--' the word to which it is being
# applied, as in '(--x)' or 'y++;'.
@ -1549,7 +1549,7 @@ nl_enum_identifier_colon = ignore # ignore/add/remove/force/not_defined
nl_enum_colon_type = ignore # ignore/add/remove/force/not_defined
# Add or remove newline between 'struct and '{'.
nl_struct_brace = ignore # ignore/add/remove/force/not_defined
nl_struct_brace = remove # ignore/add/remove/force/not_defined
# Add or remove newline between 'union' and '{'.
nl_union_brace = ignore # ignore/add/remove/force/not_defined
@ -1565,16 +1565,16 @@ nl_brace_else = remove # ignore/add/remove/force/not_defined
nl_elseif_brace = ignore # ignore/add/remove/force/not_defined
# Add or remove newline between 'else' and '{'.
nl_else_brace = ignore # ignore/add/remove/force/not_defined
nl_else_brace = remove # ignore/add/remove/force/not_defined
# Add or remove newline between 'else' and 'if'.
nl_else_if = ignore # ignore/add/remove/force/not_defined
nl_else_if = remove # ignore/add/remove/force/not_defined
# Add or remove newline before '{' opening brace
nl_before_opening_brace_func_class_def = ignore # ignore/add/remove/force/not_defined
# Add or remove newline before 'if'/'else if' closing parenthesis.
nl_before_if_closing_paren = ignore # ignore/add/remove/force/not_defined
nl_before_if_closing_paren = remove # ignore/add/remove/force/not_defined
# Add or remove newline between '}' and 'finally'.
nl_brace_finally = ignore # ignore/add/remove/force/not_defined
@ -1897,7 +1897,7 @@ nl_template_end = false # true/false
nl_oc_msg_args = false # true/false
# Add or remove newline between function signature and '{'.
nl_fdef_brace = ignore # ignore/add/remove/force/not_defined
nl_fdef_brace = force # ignore/add/remove/force/not_defined
# Add or remove newline between function signature and '{',
# if signature ends with ')'. Overrides nl_fdef_brace.
@ -1907,7 +1907,7 @@ nl_fdef_brace_cond = ignore # ignore/add/remove/force/not_defined
nl_cpp_ldef_brace = ignore # ignore/add/remove/force/not_defined
# Add or remove newline between 'return' and the return expression.
nl_return_expr = ignore # ignore/add/remove/force/not_defined
nl_return_expr = remove # ignore/add/remove/force/not_defined
# Whether to add a newline after semicolons, except in 'for' statements.
nl_after_semicolon = false # true/false
@ -2093,7 +2093,7 @@ donot_add_nl_before_cpp_comment = false # true/false
#
# The maximum number of consecutive newlines (3 = 2 blank lines).
nl_max = 0 # unsigned number
nl_max = 3 # unsigned number
# The maximum number of consecutive newlines in a function.
nl_max_blank_in_func = 0 # unsigned number
@ -2886,7 +2886,7 @@ cmt_insert_before_ctor_dtor = false # true/false
#
# Add or remove braces on a single-line 'do' statement.
mod_full_brace_do = ignore # ignore/add/remove/force/not_defined
mod_full_brace_do = add # ignore/add/remove/force/not_defined
# Add or remove braces on a single-line 'for' statement.
mod_full_brace_for = add # ignore/add/remove/force/not_defined
@ -2947,10 +2947,10 @@ mod_pawn_semicolon = false # true/false
mod_full_paren_if_bool = false # true/false
# Whether to remove superfluous semicolons.
mod_remove_extra_semicolon = false # true/false
mod_remove_extra_semicolon = true # true/false
# Whether to remove duplicate include.
mod_remove_duplicate_include = false # true/false
mod_remove_duplicate_include = true # true/false
# If a function body exceeds the specified number of newlines and doesn't have
# a comment after the close brace, a comment will be added.
@ -3307,5 +3307,5 @@ set QUESTION REAL_FATTR_CONST
set QUESTION REAL_FATTR_NONNULL_ALL
set QUESTION REAL_FATTR_PURE
set QUESTION REAL_FATTR_WARN_UNUSED_RESULT
# option(s) with 'not default' value: 67
# option(s) with 'not default' value: 69
#