refactor: format files with uncrustify #15607

This commit is contained in:
dundargoc 2021-09-10 15:14:15 +02:00 committed by GitHub
parent aab3583e74
commit 3b3dbcf7b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 4112 additions and 3586 deletions

View File

@ -184,7 +184,7 @@ sp_paren_brace = ignore # ignore/add/remove/force/not_defined
sp_brace_brace = ignore # ignore/add/remove/force/not_defined sp_brace_brace = ignore # ignore/add/remove/force/not_defined
# Add or remove space before pointer star '*'. # Add or remove space before pointer star '*'.
sp_before_ptr_star = ignore # ignore/add/remove/force/not_defined sp_before_ptr_star = force # ignore/add/remove/force/not_defined
# Add or remove space before pointer star '*' that isn't followed by a # Add or remove space before pointer star '*' that isn't followed by a
# variable name. If set to ignore, sp_before_ptr_star is used instead. # variable name. If set to ignore, sp_before_ptr_star is used instead.
@ -3279,5 +3279,5 @@ set PREPROC REAL_FATTR_CONST
set PREPROC REAL_FATTR_NONNULL_ALL set PREPROC REAL_FATTR_NONNULL_ALL
set PREPROC REAL_FATTR_PURE set PREPROC REAL_FATTR_PURE
set PREPROC REAL_FATTR_WARN_UNUSED_RESULT set PREPROC REAL_FATTR_WARN_UNUSED_RESULT
# option(s) with 'not default' value: 58 # option(s) with 'not default' value: 59
# #

File diff suppressed because it is too large Load Diff

View File

@ -329,9 +329,9 @@ void ex_align(exarg_T *eap)
*/ */
static int linelen(int *has_tab) static int linelen(int *has_tab)
{ {
char_u *line; char_u *line;
char_u *first; char_u *first;
char_u *last; char_u *last;
int save; int save;
int len; int len;
@ -363,8 +363,8 @@ static int linelen(int *has_tab)
/* Buffer for two lines used during sorting. They are allocated to /* Buffer for two lines used during sorting. They are allocated to
* contain the longest line being sorted. */ * contain the longest line being sorted. */
static char_u *sortbuf1; static char_u *sortbuf1;
static char_u *sortbuf2; static char_u *sortbuf2;
static int sort_lc; ///< sort using locale static int sort_lc; ///< sort using locale
static int sort_ic; ///< ignore case static int sort_ic; ///< ignore case
@ -461,9 +461,9 @@ void ex_sort(exarg_T *eap)
long maxlen = 0; long maxlen = 0;
size_t count = (size_t)(eap->line2 - eap->line1 + 1); size_t count = (size_t)(eap->line2 - eap->line1 + 1);
size_t i; size_t i;
char_u *p; char_u *p;
char_u *s; char_u *s;
char_u *s2; char_u *s2;
char_u c; // temporary character storage char_u c; // temporary character storage
bool unique = false; bool unique = false;
long deleted; long deleted;
@ -738,8 +738,8 @@ void ex_retab(exarg_T *eap)
long start_col = 0; // For start of white-space string long start_col = 0; // For start of white-space string
long start_vcol = 0; // For start of white-space string long start_vcol = 0; // For start of white-space string
long old_len; long old_len;
char_u *ptr; char_u *ptr;
char_u *new_line = (char_u *)1; // init to non-NULL char_u *new_line = (char_u *)1; // init to non-NULL
int did_undo; // called u_save for current line int did_undo; // called u_save for current line
long *new_vts_array = NULL; long *new_vts_array = NULL;
char_u *new_ts_str; // string value of tab argument char_u *new_ts_str; // string value of tab argument
@ -906,7 +906,7 @@ void ex_retab(exarg_T *eap)
*/ */
int do_move(linenr_T line1, linenr_T line2, linenr_T dest) int do_move(linenr_T line1, linenr_T line2, linenr_T dest)
{ {
char_u *str; char_u *str;
linenr_T l; linenr_T l;
linenr_T extra; // Num lines added before line1 linenr_T extra; // Num lines added before line1
linenr_T num_lines; // Num lines moved linenr_T num_lines; // Num lines moved
@ -1058,7 +1058,7 @@ int do_move(linenr_T line1, linenr_T line2, linenr_T dest)
void ex_copy(linenr_T line1, linenr_T line2, linenr_T n) void ex_copy(linenr_T line1, linenr_T line2, linenr_T n)
{ {
linenr_T count; linenr_T count;
char_u *p; char_u *p;
count = line2 - line1 + 1; count = line2 - line1 + 1;
curbuf->b_op_start.lnum = n + 1; curbuf->b_op_start.lnum = n + 1;
@ -1107,7 +1107,7 @@ void ex_copy(linenr_T line1, linenr_T line2, linenr_T n)
msgmore((long)count); msgmore((long)count);
} }
static char_u *prevcmd = NULL; // the previous command static char_u *prevcmd = NULL; // the previous command
#if defined(EXITFREE) #if defined(EXITFREE)
void free_prev_shellcmd(void) void free_prev_shellcmd(void)
@ -1130,9 +1130,9 @@ void do_bang(int addr_count, exarg_T *eap, bool forceit, bool do_in, bool do_out
linenr_T line2 = eap->line2; // end of range linenr_T line2 = eap->line2; // end of range
char_u *newcmd = NULL; // the new command char_u *newcmd = NULL; // the new command
bool free_newcmd = false; // need to free() newcmd bool free_newcmd = false; // need to free() newcmd
char_u *t; char_u *t;
char_u *p; char_u *p;
char_u *trailarg; char_u *trailarg;
int len; int len;
int scroll_save = msg_scroll; int scroll_save = msg_scroll;
@ -1265,13 +1265,13 @@ void do_bang(int addr_count, exarg_T *eap, bool forceit, bool do_in, bool do_out
static void do_filter(linenr_T line1, linenr_T line2, exarg_T *eap, char_u *cmd, bool do_in, static void do_filter(linenr_T line1, linenr_T line2, exarg_T *eap, char_u *cmd, bool do_in,
bool do_out) bool do_out)
{ {
char_u *itmp = NULL; char_u *itmp = NULL;
char_u *otmp = NULL; char_u *otmp = NULL;
linenr_T linecount; linenr_T linecount;
linenr_T read_linecount; linenr_T read_linecount;
pos_T cursor_save; pos_T cursor_save;
char_u *cmd_buf; char_u *cmd_buf;
buf_T *old_curbuf = curbuf; buf_T *old_curbuf = curbuf;
int shell_flags = 0; int shell_flags = 0;
const int stmp = p_stmp; const int stmp = p_stmp;
@ -1684,8 +1684,8 @@ void print_line(linenr_T lnum, int use_number, int list)
int rename_buffer(char_u *new_fname) int rename_buffer(char_u *new_fname)
{ {
char_u *fname, *sfname, *xfname; char_u *fname, *sfname, *xfname;
buf_T *buf; buf_T *buf;
buf = curbuf; buf = curbuf;
apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf);
@ -1795,11 +1795,11 @@ void ex_write(exarg_T *eap)
int do_write(exarg_T *eap) int do_write(exarg_T *eap)
{ {
int other; int other;
char_u *fname = NULL; // init to shut up gcc char_u *fname = NULL; // init to shut up gcc
char_u *ffname; char_u *ffname;
int retval = FAIL; int retval = FAIL;
char_u *free_fname = NULL; char_u *free_fname = NULL;
buf_T *alt_buf = NULL; buf_T *alt_buf = NULL;
int name_was_missing; int name_was_missing;
if (not_writing()) { // check 'write' option if (not_writing()) { // check 'write' option
@ -1879,7 +1879,7 @@ int do_write(exarg_T *eap)
if (check_overwrite(eap, curbuf, fname, ffname, other) == OK) { if (check_overwrite(eap, curbuf, fname, ffname, other) == OK) {
if (eap->cmdidx == CMD_saveas && alt_buf != NULL) { if (eap->cmdidx == CMD_saveas && alt_buf != NULL) {
buf_T *was_curbuf = curbuf; buf_T *was_curbuf = curbuf;
apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf);
apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, alt_buf); apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, alt_buf);
@ -1999,9 +1999,9 @@ int check_overwrite(exarg_T *eap, buf_T *buf, char_u *fname, char_u *ffname, int
// For ":w! filename" check that no swap file exists for "filename". // For ":w! filename" check that no swap file exists for "filename".
if (other && !emsg_silent) { if (other && !emsg_silent) {
char_u *dir; char_u *dir;
char_u *p; char_u *p;
char_u *swapname; char_u *swapname;
/* We only try the first entry in 'directory', without checking if /* We only try the first entry in 'directory', without checking if
* it's writable. If the "." directory is not writable the write * it's writable. If the "." directory is not writable the write
@ -2196,7 +2196,7 @@ int getfile(int fnum, char_u *ffname_arg, char_u *sfname_arg, int setpm, linenr_
char_u *sfname = sfname_arg; char_u *sfname = sfname_arg;
int other; int other;
int retval; int retval;
char_u *free_me = NULL; char_u *free_me = NULL;
if (text_locked()) { if (text_locked()) {
return GETFILE_ERROR; return GETFILE_ERROR;
@ -2291,20 +2291,20 @@ int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T new
int oldbuf; // TRUE if using existing buffer int oldbuf; // TRUE if using existing buffer
int auto_buf = FALSE; /* TRUE if autocommands brought us int auto_buf = FALSE; /* TRUE if autocommands brought us
into the buffer unexpectedly */ into the buffer unexpectedly */
char_u *new_name = NULL; char_u *new_name = NULL;
int did_set_swapcommand = FALSE; int did_set_swapcommand = FALSE;
buf_T *buf; buf_T *buf;
bufref_T bufref; bufref_T bufref;
bufref_T old_curbuf; bufref_T old_curbuf;
char_u *free_fname = NULL; char_u *free_fname = NULL;
int retval = FAIL; int retval = FAIL;
long n; long n;
pos_T orig_pos; pos_T orig_pos;
linenr_T topline = 0; linenr_T topline = 0;
int newcol = -1; int newcol = -1;
int solcol = -1; int solcol = -1;
pos_T *pos; pos_T *pos;
char_u *command = NULL; char_u *command = NULL;
int did_get_winopts = FALSE; int did_get_winopts = FALSE;
int readfile_flags = 0; int readfile_flags = 0;
bool did_inc_redrawing_disabled = false; bool did_inc_redrawing_disabled = false;
@ -2911,11 +2911,11 @@ static int append_indent = 0; // autoindent for first line
*/ */
void ex_append(exarg_T *eap) void ex_append(exarg_T *eap)
{ {
char_u *theline; char_u *theline;
bool did_undo = false; bool did_undo = false;
linenr_T lnum = eap->line2; linenr_T lnum = eap->line2;
int indent = 0; int indent = 0;
char_u *p; char_u *p;
int vcol; int vcol;
int empty = (curbuf->b_ml.ml_flags & ML_EMPTY); int empty = (curbuf->b_ml.ml_flags & ML_EMPTY);
@ -3079,9 +3079,9 @@ void ex_change(exarg_T *eap)
void ex_z(exarg_T *eap) void ex_z(exarg_T *eap)
{ {
char_u *x; char_u *x;
int64_t bigness; int64_t bigness;
char_u *kind; char_u *kind;
int minus = 0; int minus = 0;
linenr_T start, end, curs, i; linenr_T start, end, curs, i;
int j; int j;
@ -3648,8 +3648,8 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
colnr_T copycol; colnr_T copycol;
colnr_T matchcol; colnr_T matchcol;
colnr_T prev_matchcol = MAXCOL; colnr_T prev_matchcol = MAXCOL;
char_u *new_end, *new_start = NULL; char_u *new_end, *new_start = NULL;
char_u *p1; char_u *p1;
int did_sub = FALSE; int did_sub = FALSE;
int lastone; int lastone;
long nmatch_tl = 0; // nr of lines matched below lnum long nmatch_tl = 0; // nr of lines matched below lnum
@ -3831,8 +3831,8 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
*/ */
while (subflags.do_ask) { while (subflags.do_ask) {
if (exmode_active) { if (exmode_active) {
char *prompt; char *prompt;
char_u *resp; char_u *resp;
colnr_T sc, ec; colnr_T sc, ec;
print_line_no_prefix(lnum, subflags.do_number, subflags.do_list); print_line_no_prefix(lnum, subflags.do_number, subflags.do_list);
@ -4513,10 +4513,10 @@ void ex_global(exarg_T *eap)
linenr_T lnum; // line number according to old situation linenr_T lnum; // line number according to old situation
int ndone = 0; int ndone = 0;
int type; // first char of cmd: 'v' or 'g' int type; // first char of cmd: 'v' or 'g'
char_u *cmd; // command argument char_u *cmd; // command argument
char_u delim; // delimiter, normally '/' char_u delim; // delimiter, normally '/'
char_u *pat; char_u *pat;
regmmatch_T regmatch; regmmatch_T regmatch;
int match; int match;
int which_pat; int which_pat;
@ -4726,20 +4726,20 @@ bool prepare_tagpreview(bool undo_sync)
*/ */
void ex_help(exarg_T *eap) void ex_help(exarg_T *eap)
{ {
char_u *arg; char_u *arg;
char_u *tag; char_u *tag;
FILE *helpfd; // file descriptor of help file FILE *helpfd; // file descriptor of help file
int n; int n;
int i; int i;
win_T *wp; win_T *wp;
int num_matches; int num_matches;
char_u **matches; char_u **matches;
char_u *p; char_u *p;
int empty_fnum = 0; int empty_fnum = 0;
int alt_fnum = 0; int alt_fnum = 0;
buf_T *buf; buf_T *buf;
int len; int len;
char_u *lang; char_u *lang;
const bool old_KeyTyped = KeyTyped; const bool old_KeyTyped = KeyTyped;
if (eap != NULL) { if (eap != NULL) {
@ -4940,7 +4940,7 @@ char_u *check_help_lang(char_u *arg)
int help_heuristic(char_u *matched_string, int offset, int wrong_case) int help_heuristic(char_u *matched_string, int offset, int wrong_case)
{ {
int num_letters; int num_letters;
char_u *p; char_u *p;
num_letters = 0; num_letters = 0;
for (p = matched_string; *p; p++) { for (p = matched_string; *p; p++) {
@ -4982,8 +4982,8 @@ int help_heuristic(char_u *matched_string, int offset, int wrong_case)
*/ */
static int help_compare(const void *s1, const void *s2) static int help_compare(const void *s1, const void *s2)
{ {
char *p1; char *p1;
char *p2; char *p2;
p1 = *(char **)s1 + strlen(*(char **)s1) + 1; p1 = *(char **)s1 + strlen(*(char **)s1) + 1;
p2 = *(char **)s2 + strlen(*(char **)s2) + 1; p2 = *(char **)s2 + strlen(*(char **)s2) + 1;
@ -5274,7 +5274,7 @@ static void prepare_help_buffer(void)
void fix_help_buffer(void) void fix_help_buffer(void)
{ {
linenr_T lnum; linenr_T lnum;
char_u *line; char_u *line;
bool in_example = false; bool in_example = false;
// Set filetype to "help". // Set filetype to "help".
@ -5338,10 +5338,10 @@ void fix_help_buffer(void)
if (rt != NULL if (rt != NULL
&& path_full_compare(rt, NameBuff, false, true) != kEqualFiles) { && path_full_compare(rt, NameBuff, false, true) != kEqualFiles) {
int fcount; int fcount;
char_u **fnames; char_u **fnames;
char_u *s; char_u *s;
vimconv_T vc; vimconv_T vc;
char_u *cp; char_u *cp;
// Find all "doc/ *.txt" files in this directory. // Find all "doc/ *.txt" files in this directory.
if (!add_pathsep((char *)NameBuff) if (!add_pathsep((char *)NameBuff)
@ -5498,9 +5498,9 @@ static void helptags_one(char_u *dir, const char_u *ext, const char_u *tagfname,
{ {
garray_T ga; garray_T ga;
int filecount; int filecount;
char_u **files; char_u **files;
char_u *p1, *p2; char_u *p1, *p2;
char_u *s; char_u *s;
TriState utf8 = kNone; TriState utf8 = kNone;
bool mix = false; // detected mixed encodings bool mix = false; // detected mixed encodings
@ -6125,7 +6125,7 @@ char_u *skip_vimgrep_pat(char_u *p, char_u **s, int *flags)
/// List v:oldfiles in a nice way. /// List v:oldfiles in a nice way.
void ex_oldfiles(exarg_T *eap) void ex_oldfiles(exarg_T *eap)
{ {
list_T *l = get_vim_var_list(VV_OLDFILES); list_T *l = get_vim_var_list(VV_OLDFILES);
long nr = 0; long nr = 0;
if (l == NULL) { if (l == NULL) {

View File

@ -80,14 +80,14 @@ static int quitmore = 0;
static bool ex_pressedreturn = false; static bool ex_pressedreturn = false;
typedef struct ucmd { typedef struct ucmd {
char_u *uc_name; // The command name char_u *uc_name; // The command name
uint32_t uc_argt; // The argument type uint32_t uc_argt; // The argument type
char_u *uc_rep; // The command's replacement string char_u *uc_rep; // The command's replacement string
long uc_def; // The default value for a range/count long uc_def; // The default value for a range/count
int uc_compl; // completion type int uc_compl; // completion type
cmd_addr_T uc_addr_type; // The command's address type cmd_addr_T uc_addr_type; // The command's address type
sctx_T uc_script_ctx; // SCTX where the command was defined sctx_T uc_script_ctx; // SCTX where the command was defined
char_u *uc_compl_arg; // completion argument if any char_u *uc_compl_arg; // completion argument if any
} ucmd_T; } ucmd_T;
#define UC_BUFFER 1 // -buffer: local to current buffer #define UC_BUFFER 1 // -buffer: local to current buffer
@ -102,7 +102,7 @@ static garray_T ucmds = { 0, 0, sizeof(ucmd_T), 4, NULL };
// Struct for storing a line inside a while/for loop // Struct for storing a line inside a while/for loop
typedef struct { typedef struct {
char_u *line; // command line char_u *line; // command line
linenr_T lnum; // sourcing_lnum of the line linenr_T lnum; // sourcing_lnum of the line
} wcmd_T; } wcmd_T;
@ -114,12 +114,12 @@ typedef struct {
* reads more lines that may come from the while/for loop. * reads more lines that may come from the while/for loop.
*/ */
struct loop_cookie { struct loop_cookie {
garray_T *lines_gap; // growarray with line info garray_T *lines_gap; // growarray with line info
int current_line; // last read line from growarray int current_line; // last read line from growarray
int repeating; // TRUE when looping a second time int repeating; // TRUE when looping a second time
// When "repeating" is FALSE use "getline" and "cookie" to get lines // When "repeating" is FALSE use "getline" and "cookie" to get lines
char_u *(*getline)(int, void *, int, bool); char_u *(*getline)(int, void *, int, bool);
void *cookie; void *cookie;
}; };
@ -127,14 +127,14 @@ struct loop_cookie {
struct dbg_stuff { struct dbg_stuff {
int trylevel; int trylevel;
int force_abort; int force_abort;
except_T *caught_stack; except_T *caught_stack;
char_u *vv_exception; char_u *vv_exception;
char_u *vv_throwpoint; char_u *vv_throwpoint;
int did_emsg; int did_emsg;
int got_int; int got_int;
int need_rethrow; int need_rethrow;
int check_cstack; int check_cstack;
except_T *current_exception; except_T *current_exception;
}; };
#ifdef INCLUDE_GENERATED_DECLARATIONS #ifdef INCLUDE_GENERATED_DECLARATIONS
@ -309,8 +309,8 @@ int do_cmdline_cmd(const char *cmd)
/// @return FAIL if cmdline could not be executed, OK otherwise /// @return FAIL if cmdline could not be executed, OK otherwise
int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags) int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags)
{ {
char_u *next_cmdline; // next cmd to execute char_u *next_cmdline; // next cmd to execute
char_u *cmdline_copy = NULL; // copy of cmd line char_u *cmdline_copy = NULL; // copy of cmd line
bool used_getline = false; // used "fgetline" to obtain command bool used_getline = false; // used "fgetline" to obtain command
static int recursive = 0; // recursive depth static int recursive = 0; // recursive depth
bool msg_didout_before_start = false; bool msg_didout_before_start = false;
@ -322,19 +322,19 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags)
}; };
garray_T lines_ga; // keep lines for ":while"/":for" garray_T lines_ga; // keep lines for ":while"/":for"
int current_line = 0; // active line in lines_ga int current_line = 0; // active line in lines_ga
char_u *fname = NULL; // function or script name char_u *fname = NULL; // function or script name
linenr_T *breakpoint = NULL; // ptr to breakpoint field in cookie linenr_T *breakpoint = NULL; // ptr to breakpoint field in cookie
int *dbg_tick = NULL; // ptr to dbg_tick field in cookie int *dbg_tick = NULL; // ptr to dbg_tick field in cookie
struct dbg_stuff debug_saved; // saved things for debug mode struct dbg_stuff debug_saved; // saved things for debug mode
int initial_trylevel; int initial_trylevel;
struct msglist **saved_msg_list = NULL; struct msglist **saved_msg_list = NULL;
struct msglist *private_msg_list; struct msglist *private_msg_list;
// "fgetline" and "cookie" passed to do_one_cmd() // "fgetline" and "cookie" passed to do_one_cmd()
char_u *(*cmd_getline)(int, void *, int, bool); char_u *(*cmd_getline)(int, void *, int, bool);
void *cmd_cookie; void *cmd_cookie;
struct loop_cookie cmd_loop_cookie; struct loop_cookie cmd_loop_cookie;
void *real_cookie; void *real_cookie;
int getline_is_func; int getline_is_func;
static int call_depth = 0; // recursiveness static int call_depth = 0; // recursiveness
@ -964,9 +964,9 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags)
*/ */
static char_u *get_loop_line(int c, void *cookie, int indent, bool do_concat) static char_u *get_loop_line(int c, void *cookie, int indent, bool do_concat)
{ {
struct loop_cookie *cp = (struct loop_cookie *)cookie; struct loop_cookie *cp = (struct loop_cookie *)cookie;
wcmd_T *wp; wcmd_T *wp;
char_u *line; char_u *line;
if (cp->current_line + 1 >= cp->lines_gap->ga_len) { if (cp->current_line + 1 >= cp->lines_gap->ga_len) {
if (cp->repeating) { if (cp->repeating) {
@ -1251,16 +1251,16 @@ static char_u *skip_colon_white(const char_u *p, bool skipleadingwhite)
static char_u * do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGetter fgetline, static char_u * do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGetter fgetline,
void *cookie) void *cookie)
{ {
char_u *p; char_u *p;
linenr_T lnum; linenr_T lnum;
long n; long n;
char_u *errormsg = NULL; // error message char_u *errormsg = NULL; // error message
char_u *after_modifier = NULL; char_u *after_modifier = NULL;
exarg_T ea; exarg_T ea;
const int save_msg_scroll = msg_scroll; const int save_msg_scroll = msg_scroll;
cmdmod_T save_cmdmod; cmdmod_T save_cmdmod;
const int save_reg_executing = reg_executing; const int save_reg_executing = reg_executing;
char_u *cmd; char_u *cmd;
memset(&ea, 0, sizeof(ea)); memset(&ea, 0, sizeof(ea));
ea.line1 = 1; ea.line1 = 1;
@ -2578,7 +2578,7 @@ static char_u *find_command(exarg_T *eap, int *full)
FUNC_ATTR_NONNULL_ARG(1) FUNC_ATTR_NONNULL_ARG(1)
{ {
int len; int len;
char_u *p; char_u *p;
int i; int i;
/* /*
@ -2701,11 +2701,11 @@ static char_u *find_ucmd(exarg_T *eap, char_u *p, int *full, expand_T *xp, int *
{ {
int len = (int)(p - eap->cmd); int len = (int)(p - eap->cmd);
int j, k, matchlen = 0; int j, k, matchlen = 0;
ucmd_T *uc; ucmd_T *uc;
int found = FALSE; int found = FALSE;
int possible = FALSE; int possible = FALSE;
char_u *cp, *np; // Point into typed cmd and test name char_u *cp, *np; // Point into typed cmd and test name
garray_T *gap; garray_T *gap;
int amb_local = FALSE; /* Found ambiguous buffer-local command, int amb_local = FALSE; /* Found ambiguous buffer-local command,
only full match global is accepted. */ only full match global is accepted. */
@ -2799,7 +2799,7 @@ static char_u *find_ucmd(exarg_T *eap, char_u *p, int *full, expand_T *xp, int *
} }
static struct cmdmod { static struct cmdmod {
char *name; char *name;
int minlen; int minlen;
int has_count; // :123verbose :3tab int has_count; // :123verbose :3tab
} cmdmods[] = { } cmdmods[] = {
@ -2834,7 +2834,7 @@ static struct cmdmod {
*/ */
int modifier_len(char_u *cmd) int modifier_len(char_u *cmd)
{ {
char_u *p = cmd; char_u *p = cmd;
if (ascii_isdigit(*cmd)) { if (ascii_isdigit(*cmd)) {
p = skipwhite(skipdigits(cmd + 1)); p = skipwhite(skipdigits(cmd + 1));
@ -2863,7 +2863,7 @@ int modifier_len(char_u *cmd)
int cmd_exists(const char *const name) int cmd_exists(const char *const name)
{ {
exarg_T ea; exarg_T ea;
char_u *p; char_u *p;
// Check command modifiers. // Check command modifiers.
for (int i = 0; i < (int)ARRAY_SIZE(cmdmods); i++) { for (int i = 0; i < (int)ARRAY_SIZE(cmdmods); i++) {
@ -3851,9 +3851,9 @@ static linenr_T get_address(exarg_T *eap, char_u **ptr, cmd_addr_T addr_type, in
int c; int c;
int i; int i;
long n; long n;
char_u *cmd; char_u *cmd;
pos_T pos; pos_T pos;
pos_T *fp; pos_T *fp;
linenr_T lnum; linenr_T lnum;
buf_T *buf; buf_T *buf;
@ -4296,7 +4296,7 @@ static void correct_range(exarg_T *eap)
*/ */
static char_u *skip_grep_pat(exarg_T *eap) static char_u *skip_grep_pat(exarg_T *eap)
{ {
char_u *p = eap->arg; char_u *p = eap->arg;
if (*p != NUL && (eap->cmdidx == CMD_vimgrep || eap->cmdidx == CMD_lvimgrep if (*p != NUL && (eap->cmdidx == CMD_vimgrep || eap->cmdidx == CMD_lvimgrep
|| eap->cmdidx == CMD_vimgrepadd || eap->cmdidx == CMD_vimgrepadd
@ -4316,10 +4316,10 @@ static char_u *skip_grep_pat(exarg_T *eap)
*/ */
static char_u *replace_makeprg(exarg_T *eap, char_u *p, char_u **cmdlinep) static char_u *replace_makeprg(exarg_T *eap, char_u *p, char_u **cmdlinep)
{ {
char_u *new_cmdline; char_u *new_cmdline;
char_u *program; char_u *program;
char_u *pos; char_u *pos;
char_u *ptr; char_u *ptr;
int len; int len;
int i; int i;
@ -4387,9 +4387,9 @@ static char_u *replace_makeprg(exarg_T *eap, char_u *p, char_u **cmdlinep)
int expand_filename(exarg_T *eap, char_u **cmdlinep, char_u **errormsgp) int expand_filename(exarg_T *eap, char_u **cmdlinep, char_u **errormsgp)
{ {
int has_wildcards; // need to expand wildcards int has_wildcards; // need to expand wildcards
char_u *repl; char_u *repl;
size_t srclen; size_t srclen;
char_u *p; char_u *p;
int escaped; int escaped;
// Skip a regexp pattern for ":vimgrep[add] pat file..." // Skip a regexp pattern for ":vimgrep[add] pat file..."
@ -4459,7 +4459,7 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char_u **errormsgp)
&& eap->cmdidx != CMD_make && eap->cmdidx != CMD_make
&& eap->cmdidx != CMD_terminal && eap->cmdidx != CMD_terminal
&& !(eap->argt & EX_NOSPC)) { && !(eap->argt & EX_NOSPC)) {
char_u *l; char_u *l;
#ifdef BACKSLASH_IN_FILENAME #ifdef BACKSLASH_IN_FILENAME
/* Don't escape a backslash here, because rem_backslash() doesn't /* Don't escape a backslash here, because rem_backslash() doesn't
* remove it later. */ * remove it later. */
@ -4484,7 +4484,7 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char_u **errormsgp)
|| eap->cmdidx == CMD_bang || eap->cmdidx == CMD_bang
|| eap->cmdidx == CMD_terminal) || eap->cmdidx == CMD_terminal)
&& vim_strpbrk(repl, (char_u *)"!") != NULL) { && vim_strpbrk(repl, (char_u *)"!") != NULL) {
char_u *l; char_u *l;
l = vim_strsave_escaped(repl, (char_u *)"!"); l = vim_strsave_escaped(repl, (char_u *)"!");
xfree(repl); xfree(repl);
@ -4610,7 +4610,7 @@ static char_u *repl_cmdline(exarg_T *eap, char_u *src, size_t srclen, char_u *re
*/ */
void separate_nextcmd(exarg_T *eap) void separate_nextcmd(exarg_T *eap)
{ {
char_u *p; char_u *p;
p = skip_grep_pat(eap); p = skip_grep_pat(eap);
@ -4727,10 +4727,10 @@ int get_bad_opt(const char_u *p, exarg_T *eap)
*/ */
static int getargopt(exarg_T *eap) static int getargopt(exarg_T *eap)
{ {
char_u *arg = eap->arg + 2; char_u *arg = eap->arg + 2;
int *pp = NULL; int *pp = NULL;
int bad_char_idx; int bad_char_idx;
char_u *p; char_u *p;
// ":edit ++[no]bin[ary] file" // ":edit ++[no]bin[ary] file"
if (STRNCMP(arg, "bin", 3) == 0 || STRNCMP(arg, "nobin", 5) == 0) { if (STRNCMP(arg, "bin", 3) == 0 || STRNCMP(arg, "nobin", 5) == 0) {
@ -5154,11 +5154,11 @@ static int uc_add_command(char_u *name, size_t name_len, char_u *rep, uint32_t a
int flags, int compl, char_u *compl_arg, cmd_addr_T addr_type, bool force) int flags, int compl, char_u *compl_arg, cmd_addr_T addr_type, bool force)
FUNC_ATTR_NONNULL_ARG(1, 3) FUNC_ATTR_NONNULL_ARG(1, 3)
{ {
ucmd_T *cmd = NULL; ucmd_T *cmd = NULL;
int i; int i;
int cmp = 1; int cmp = 1;
char_u *rep_buf = NULL; char_u *rep_buf = NULL;
garray_T *gap; garray_T *gap;
replace_termcodes(rep, STRLEN(rep), &rep_buf, false, false, true, replace_termcodes(rep, STRLEN(rep), &rep_buf, false, false, true,
CPO_TO_CPO_FLAGS); CPO_TO_CPO_FLAGS);
@ -5325,7 +5325,7 @@ static void uc_list(char_u *name, size_t name_len)
{ {
int i, j; int i, j;
bool found = false; bool found = false;
ucmd_T *cmd; ucmd_T *cmd;
uint32_t a; uint32_t a;
// In cmdwin, the alternative buffer should be used. // In cmdwin, the alternative buffer should be used.
@ -5489,7 +5489,7 @@ static int uc_scan_attr(char_u *attr, size_t len, uint32_t *argt, long *def, int
int *complp, char_u **compl_arg, cmd_addr_T *addr_type_arg) int *complp, char_u **compl_arg, cmd_addr_T *addr_type_arg)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_ALL
{ {
char_u *p; char_u *p;
if (len == 0) { if (len == 0) {
EMSG(_("E175: No attribute specified")); EMSG(_("E175: No attribute specified"));
@ -5507,7 +5507,7 @@ static int uc_scan_attr(char_u *attr, size_t len, uint32_t *argt, long *def, int
*argt |= EX_TRLBAR; *argt |= EX_TRLBAR;
} else { } else {
int i; int i;
char_u *val = NULL; char_u *val = NULL;
size_t vallen = 0; size_t vallen = 0;
size_t attrlen = len; size_t attrlen = len;
@ -5630,14 +5630,14 @@ static char e_complete_used_without_nargs[] = N_("E1208: -complete used without
*/ */
static void ex_command(exarg_T *eap) static void ex_command(exarg_T *eap)
{ {
char_u *name; char_u *name;
char_u *end; char_u *end;
char_u *p; char_u *p;
uint32_t argt = 0; uint32_t argt = 0;
long def = -1; long def = -1;
int flags = 0; int flags = 0;
int compl = EXPAND_NOTHING; int compl = EXPAND_NOTHING;
char_u *compl_arg = NULL; char_u *compl_arg = NULL;
cmd_addr_T addr_type_arg = ADDR_NONE; cmd_addr_T addr_type_arg = ADDR_NONE;
int has_attr = (eap->arg[0] == '-'); int has_attr = (eap->arg[0] == '-');
int name_len; int name_len;
@ -5696,7 +5696,7 @@ void ex_comclear(exarg_T *eap)
uc_clear(&curbuf->b_ucmds); 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_name);
xfree(cmd->uc_rep); xfree(cmd->uc_rep);
xfree(cmd->uc_compl_arg); xfree(cmd->uc_compl_arg);
@ -5713,9 +5713,9 @@ void uc_clear(garray_T *gap)
static void ex_delcommand(exarg_T *eap) static void ex_delcommand(exarg_T *eap)
{ {
int i = 0; int i = 0;
ucmd_T *cmd = NULL; ucmd_T *cmd = NULL;
int cmp = -1; int cmp = -1;
garray_T *gap; garray_T *gap;
gap = &curbuf->b_ucmds; gap = &curbuf->b_ucmds;
for (;; ) { for (;; ) {
@ -5854,7 +5854,7 @@ static size_t uc_check_code(char_u *code, size_t len, char_u *buf, ucmd_T *cmd,
char_u **split_buf, size_t *split_len) char_u **split_buf, size_t *split_len)
{ {
size_t result = 0; size_t result = 0;
char_u *p = code + 1; char_u *p = code + 1;
size_t l = len - 2; size_t l = len - 2;
int quote = 0; int quote = 0;
enum { enum {
@ -6132,18 +6132,18 @@ static size_t uc_check_code(char_u *code, size_t len, char_u *buf, ucmd_T *cmd,
static void do_ucmd(exarg_T *eap) static void do_ucmd(exarg_T *eap)
{ {
char_u *buf; char_u *buf;
char_u *p; char_u *p;
char_u *q; char_u *q;
char_u *start; char_u *start;
char_u *end = NULL; char_u *end = NULL;
char_u *ksp; char_u *ksp;
size_t len, totlen; size_t len, totlen;
size_t split_len = 0; size_t split_len = 0;
char_u *split_buf = NULL; char_u *split_buf = NULL;
ucmd_T *cmd; ucmd_T *cmd;
const sctx_T save_current_sctx = current_sctx; const sctx_T save_current_sctx = current_sctx;
if (eap->cmdidx == CMD_USER) { if (eap->cmdidx == CMD_USER) {
@ -6643,7 +6643,7 @@ static void ex_pclose(exarg_T *eap)
void ex_win_close(int forceit, win_T *win, tabpage_T *tp) void ex_win_close(int forceit, win_T *win, tabpage_T *tp)
{ {
int need_hide; int need_hide;
buf_T *buf = win->w_buffer; buf_T *buf = win->w_buffer;
// Never close the autocommand window. // Never close the autocommand window.
if (win == aucmd_win) { if (win == aucmd_win) {
@ -6682,7 +6682,7 @@ void ex_win_close(int forceit, win_T *win, tabpage_T *tp)
*/ */
static void ex_tabclose(exarg_T *eap) static void ex_tabclose(exarg_T *eap)
{ {
tabpage_T *tp; tabpage_T *tp;
if (cmdwin_type != 0) { if (cmdwin_type != 0) {
cmdwin_result = K_IGNORE; cmdwin_result = K_IGNORE;
@ -6767,7 +6767,7 @@ void tabpage_close(int forceit)
void tabpage_close_other(tabpage_T *tp, int forceit) void tabpage_close_other(tabpage_T *tp, int forceit)
{ {
int done = 0; int done = 0;
win_T *wp; win_T *wp;
int h = tabline_height(); int h = tabline_height();
char_u prev_idx[NUMBUFLEN]; char_u prev_idx[NUMBUFLEN];
@ -6993,11 +6993,11 @@ void alist_new(void)
*/ */
void alist_expand(int *fnum_list, int fnum_len) void alist_expand(int *fnum_list, int fnum_len)
{ {
char_u **old_arg_files; char_u **old_arg_files;
int old_arg_count; int old_arg_count;
char_u **new_arg_files; char_u **new_arg_files;
int new_arg_file_count; int new_arg_file_count;
char_u *save_p_su = p_su; char_u *save_p_su = p_su;
int i; int i;
/* Don't use 'suffixes' here. This should work like the shell did the /* Don't use 'suffixes' here. This should work like the shell did the
@ -7159,8 +7159,8 @@ static void ex_wrongmodifier(exarg_T *eap)
*/ */
void ex_splitview(exarg_T *eap) void ex_splitview(exarg_T *eap)
{ {
win_T *old_curwin = curwin; win_T *old_curwin = curwin;
char_u *fname = NULL; char_u *fname = NULL;
const bool use_tab = eap->cmdidx == CMD_tabedit const bool use_tab = eap->cmdidx == CMD_tabedit
|| eap->cmdidx == CMD_tabfind || eap->cmdidx == CMD_tabfind
|| eap->cmdidx == CMD_tabnew; || eap->cmdidx == CMD_tabnew;
@ -7364,7 +7364,7 @@ static void ex_mode(exarg_T *eap)
static void ex_resize(exarg_T *eap) static void ex_resize(exarg_T *eap)
{ {
int n; int n;
win_T *wp = curwin; win_T *wp = curwin;
if (eap->addr_count > 0) { if (eap->addr_count > 0) {
n = eap->line2; n = eap->line2;
@ -7396,7 +7396,7 @@ static void ex_resize(exarg_T *eap)
*/ */
static void ex_find(exarg_T *eap) static void ex_find(exarg_T *eap)
{ {
char_u *fname; char_u *fname;
int count; int count;
fname = find_file_in_path(eap->arg, STRLEN(eap->arg), fname = find_file_in_path(eap->arg, STRLEN(eap->arg),
@ -7579,8 +7579,8 @@ static void ex_swapname(exarg_T *eap)
*/ */
static void ex_syncbind(exarg_T *eap) static void ex_syncbind(exarg_T *eap)
{ {
win_T *save_curwin = curwin; win_T *save_curwin = curwin;
buf_T *save_curbuf = curbuf; buf_T *save_curbuf = curbuf;
long topline; long topline;
long y; long y;
linenr_T old_linenr = curwin->w_cursor.lnum; linenr_T old_linenr = curwin->w_cursor.lnum;
@ -7696,7 +7696,7 @@ static void ex_read(exarg_T *eap)
} }
} }
static char_u *prev_dir = NULL; static char_u *prev_dir = NULL;
#if defined(EXITFREE) #if defined(EXITFREE)
void free_cd_dir(void) void free_cd_dir(void)
@ -7756,8 +7756,8 @@ void post_chdir(CdScope scope, bool trigger_dirchanged)
/// `:cd`, `:tcd`, `:lcd`, `:chdir`, `:tchdir` and `:lchdir`. /// `:cd`, `:tcd`, `:lcd`, `:chdir`, `:tchdir` and `:lchdir`.
void ex_cd(exarg_T *eap) void ex_cd(exarg_T *eap)
{ {
char_u *new_dir; char_u *new_dir;
char_u *tofree; char_u *tofree;
new_dir = eap->arg; new_dir = eap->arg;
#if !defined(UNIX) #if !defined(UNIX)
@ -7895,7 +7895,7 @@ void do_sleep(long msec)
static void do_exmap(exarg_T *eap, int isabbrev) static void do_exmap(exarg_T *eap, int isabbrev)
{ {
int mode; int mode;
char_u *cmdp; char_u *cmdp;
cmdp = eap->cmd; cmdp = eap->cmd;
mode = get_map_mode(&cmdp, eap->forceit || isabbrev); mode = get_map_mode(&cmdp, eap->forceit || isabbrev);
@ -7936,7 +7936,7 @@ static void ex_winsize(exarg_T *eap)
static void ex_wincmd(exarg_T *eap) static void ex_wincmd(exarg_T *eap)
{ {
int xchar = NUL; int xchar = NUL;
char_u *p; char_u *p;
if (*eap->arg == 'g' || *eap->arg == Ctrl_G) { if (*eap->arg == 'g' || *eap->arg == Ctrl_G) {
// CTRL-W g and CTRL-W CTRL-G have an extra command character // CTRL-W g and CTRL-W CTRL-G have an extra command character
@ -8190,7 +8190,7 @@ static void ex_later(exarg_T *eap)
long count = 0; long count = 0;
bool sec = false; bool sec = false;
bool file = false; bool file = false;
char_u *p = eap->arg; char_u *p = eap->arg;
if (*p == NUL) { if (*p == NUL) {
count = 1; count = 1;
@ -8223,9 +8223,9 @@ static void ex_later(exarg_T *eap)
*/ */
static void ex_redir(exarg_T *eap) static void ex_redir(exarg_T *eap)
{ {
char *mode; char *mode;
char_u *fname; char_u *fname;
char_u *arg = eap->arg; char_u *arg = eap->arg;
if (STRICMP(eap->arg, "END") == 0) { if (STRICMP(eap->arg, "END") == 0) {
close_redir(); close_redir();
@ -8416,7 +8416,7 @@ int vim_mkdir_emsg(const char *const name, const int prot)
/// @return file descriptor, or NULL on failure. /// @return file descriptor, or NULL on failure.
FILE *open_exfile(char_u *fname, int forceit, char *mode) FILE *open_exfile(char_u *fname, int forceit, char *mode)
{ {
FILE *fd; FILE *fd;
#ifdef UNIX #ifdef UNIX
// with Unix it is possible to open a directory // with Unix it is possible to open a directory
@ -8535,9 +8535,9 @@ static void ex_normal(exarg_T *eap)
return; return;
} }
save_state_T save_state; save_state_T save_state;
char_u *arg = NULL; char_u *arg = NULL;
int l; int l;
char_u *p; char_u *p;
if (ex_normal_lock > 0) { if (ex_normal_lock > 0) {
EMSG(_(e_secure)); EMSG(_(e_secure));
@ -8708,7 +8708,7 @@ static void ex_findpat(exarg_T *eap)
{ {
int whole = TRUE; int whole = TRUE;
long n; long n;
char_u *p; char_u *p;
int action; int action;
switch (cmdnames[eap->cmdidx].cmd_name[2]) { switch (cmdnames[eap->cmdidx].cmd_name[2]) {
@ -8773,7 +8773,7 @@ static void ex_ptag(exarg_T *eap)
*/ */
static void ex_pedit(exarg_T *eap) static void ex_pedit(exarg_T *eap)
{ {
win_T *curwin_save = curwin; win_T *curwin_save = curwin;
// Open the preview window or popup and make it the current window. // Open the preview window or popup and make it the current window.
g_do_tagpreview = p_pvh; g_do_tagpreview = p_pvh;
@ -8944,11 +8944,11 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum
char_u **errormsg, int *escaped) char_u **errormsg, int *escaped)
{ {
int i; int i;
char_u *s; char_u *s;
char_u *result; char_u *result;
char_u *resultbuf = NULL; char_u *resultbuf = NULL;
size_t resultlen; size_t resultlen;
buf_T *buf; buf_T *buf;
int valid = VALID_HEAD | VALID_PATH; // Assume valid result. int valid = VALID_HEAD | VALID_PATH; // Assume valid result.
bool tilde_file = false; bool tilde_file = false;
int skip_mod = false; int skip_mod = false;
@ -9201,8 +9201,8 @@ static char_u *arg_all(void)
{ {
int len; int len;
int idx; int idx;
char_u *retval = NULL; char_u *retval = NULL;
char_u *p; char_u *p;
/* /*
* Do this loop two times: * Do this loop two times:
@ -9262,13 +9262,13 @@ static char_u *arg_all(void)
*/ */
char_u *expand_sfile(char_u *arg) char_u *expand_sfile(char_u *arg)
{ {
char_u *errormsg; char_u *errormsg;
size_t len; size_t len;
char_u *result; char_u *result;
char_u *newres; char_u *newres;
char_u *repl; char_u *repl;
size_t srclen; size_t srclen;
char_u *p; char_u *p;
result = vim_strsave(arg); result = vim_strsave(arg);
@ -9310,7 +9310,7 @@ char_u *expand_sfile(char_u *arg)
*/ */
static void ex_shada(exarg_T *eap) static void ex_shada(exarg_T *eap)
{ {
char_u *save_shada; char_u *save_shada;
save_shada = p_shada; save_shada = p_shada;
if (*p_shada == NUL) { if (*p_shada == NUL) {
@ -9404,7 +9404,7 @@ static TriState filetype_indent = kNone;
*/ */
static void ex_filetype(exarg_T *eap) static void ex_filetype(exarg_T *eap)
{ {
char_u *arg = eap->arg; char_u *arg = eap->arg;
bool plugin = false; bool plugin = false;
bool indent = false; bool indent = false;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -618,7 +618,7 @@ static void normal_redraw_mode_message(NormalState *s)
// If need to redraw, and there is a "keep_msg", redraw before the // If need to redraw, and there is a "keep_msg", redraw before the
// delay // delay
if (must_redraw && keep_msg != NULL && !emsg_on_display) { if (must_redraw && keep_msg != NULL && !emsg_on_display) {
char_u *kmsg; char_u *kmsg;
kmsg = keep_msg; kmsg = keep_msg;
keep_msg = NULL; keep_msg = NULL;
@ -1456,7 +1456,7 @@ static void set_vcount_ca(cmdarg_T *cap, bool *set_prevcount)
// "gui_yank" is true when yanking text for the clipboard. // "gui_yank" is true when yanking text for the clipboard.
void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank) void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
{ {
oparg_T *oap = cap->oap; oparg_T *oap = cap->oap;
pos_T old_cursor; pos_T old_cursor;
bool empty_region_error; bool empty_region_error;
int restart_edit_save; int restart_edit_save;
@ -2267,7 +2267,7 @@ bool do_mouse(oparg_T *oap, int c, int dir, long count, bool fixindent)
bool in_sep_line; // mouse in vertical separator line bool in_sep_line; // mouse in vertical separator line
int c1, c2; int c1, c2;
pos_T save_cursor; pos_T save_cursor;
win_T *old_curwin = curwin; win_T *old_curwin = curwin;
static pos_T orig_cursor; static pos_T orig_cursor;
colnr_T leftcol, rightcol; colnr_T leftcol, rightcol;
pos_T end_visual; pos_T end_visual;
@ -2886,7 +2886,7 @@ bool do_mouse(oparg_T *oap, int c, int dir, long count, bool fixindent)
* A double click selects a word or a block. * A double click selects a word or a block.
*/ */
if ((mod_mask & MOD_MASK_MULTI_CLICK) == MOD_MASK_2CLICK) { if ((mod_mask & MOD_MASK_MULTI_CLICK) == MOD_MASK_2CLICK) {
pos_T *pos = NULL; pos_T *pos = NULL;
int gc; int gc;
if (is_click) { if (is_click) {
@ -2961,7 +2961,7 @@ bool do_mouse(oparg_T *oap, int c, int dir, long count, bool fixindent)
*/ */
static void find_start_of_word(pos_T *pos) static void find_start_of_word(pos_T *pos)
{ {
char_u *line; char_u *line;
int cclass; int cclass;
int col; int col;
@ -2984,7 +2984,7 @@ static void find_start_of_word(pos_T *pos)
*/ */
static void find_end_of_word(pos_T *pos) static void find_end_of_word(pos_T *pos)
{ {
char_u *line; char_u *line;
int cclass; int cclass;
int col; int col;
@ -3418,7 +3418,7 @@ void clear_showcmd(void)
} else if (VIsual_mode == 'V' || VIsual.lnum != curwin->w_cursor.lnum) { } else if (VIsual_mode == 'V' || VIsual.lnum != curwin->w_cursor.lnum) {
snprintf((char *)showcmd_buf, SHOWCMD_BUFLEN, "%" PRId64, (int64_t)lines); snprintf((char *)showcmd_buf, SHOWCMD_BUFLEN, "%" PRId64, (int64_t)lines);
} else { } else {
char_u *s, *e; char_u *s, *e;
int l; int l;
int bytes = 0; int bytes = 0;
int chars = 0; int chars = 0;
@ -3469,7 +3469,7 @@ void clear_showcmd(void)
*/ */
bool add_to_showcmd(int c) bool add_to_showcmd(int c)
{ {
char_u *p; char_u *p;
int i; int i;
static int ignore[] = static int ignore[] =
{ {
@ -3615,10 +3615,10 @@ static void display_showcmd(void)
*/ */
void do_check_scrollbind(bool check) void do_check_scrollbind(bool check)
{ {
static win_T *old_curwin = NULL; static win_T *old_curwin = NULL;
static linenr_T old_topline = 0; static linenr_T old_topline = 0;
static int old_topfill = 0; static int old_topfill = 0;
static buf_T *old_buf = NULL; static buf_T *old_buf = NULL;
static colnr_T old_leftcol = 0; static colnr_T old_leftcol = 0;
if (check && curwin->w_p_scb) { if (check && curwin->w_p_scb) {
@ -3673,8 +3673,8 @@ void check_scrollbind(linenr_T topline_diff, long leftcol_diff)
{ {
bool want_ver; bool want_ver;
bool want_hor; bool want_hor;
win_T *old_curwin = curwin; win_T *old_curwin = curwin;
buf_T *old_curbuf = curbuf; buf_T *old_curbuf = curbuf;
int old_VIsual_select = VIsual_select; int old_VIsual_select = VIsual_select;
int old_VIsual_active = VIsual_active; int old_VIsual_active = VIsual_active;
colnr_T tgt_leftcol = curwin->w_leftcol; colnr_T tgt_leftcol = curwin->w_leftcol;
@ -3878,7 +3878,7 @@ static bool is_ident(char_u *line, int offset)
/// @return fail when not found. /// @return fail when not found.
bool find_decl(char_u *ptr, size_t len, bool locally, bool thisblock, int flags_arg) bool find_decl(char_u *ptr, size_t len, bool locally, bool thisblock, int flags_arg)
{ {
char_u *pat; char_u *pat;
pos_T old_pos; pos_T old_pos;
pos_T par_pos; pos_T par_pos;
pos_T found_pos; pos_T found_pos;
@ -4699,7 +4699,7 @@ dozet:
case 'G': // "zG": add good word to temp word list case 'G': // "zG": add good word to temp word list
case 'W': // "zW": add wrong word to temp word list case 'W': // "zW": add wrong word to temp word list
{ {
char_u *ptr = NULL; char_u *ptr = NULL;
size_t len; size_t len;
if (checkclearop(cap->oap)) { if (checkclearop(cap->oap)) {
@ -4958,13 +4958,13 @@ void do_nv_ident(int c1, int c2)
*/ */
static void nv_ident(cmdarg_T *cap) static void nv_ident(cmdarg_T *cap)
{ {
char_u *ptr = NULL; char_u *ptr = NULL;
char_u *p; char_u *p;
size_t n = 0; // init for GCC size_t n = 0; // init for GCC
int cmdchar; int cmdchar;
bool g_cmd; // "g" command bool g_cmd; // "g" command
bool tag_cmd = false; bool tag_cmd = false;
char_u *aux_ptr; char_u *aux_ptr;
if (cap->cmdchar == 'g') { // "g*", "g#", "g]" and "gCTRL-]" if (cap->cmdchar == 'g') { // "g*", "g#", "g]" and "gCTRL-]"
cmdchar = cap->nchar; cmdchar = cap->nchar;
@ -5513,7 +5513,7 @@ static void nv_down(cmdarg_T *cap)
*/ */
static void nv_gotofile(cmdarg_T *cap) static void nv_gotofile(cmdarg_T *cap)
{ {
char_u *ptr; char_u *ptr;
linenr_T lnum = -1; linenr_T lnum = -1;
if (text_locked()) { if (text_locked()) {
@ -5588,7 +5588,7 @@ static void nv_dollar(cmdarg_T *cap)
*/ */
static void nv_search(cmdarg_T *cap) static void nv_search(cmdarg_T *cap)
{ {
oparg_T *oap = cap->oap; oparg_T *oap = cap->oap;
pos_T save_cursor = curwin->w_cursor; pos_T save_cursor = curwin->w_cursor;
if (cap->cmdchar == '?' && cap->oap->op_type == OP_ROT13) { if (cap->cmdchar == '?' && cap->oap->op_type == OP_ROT13) {
@ -5719,7 +5719,7 @@ static void nv_brackets(cmdarg_T *cap)
{ {
pos_T new_pos = { 0, 0, 0 }; pos_T new_pos = { 0, 0, 0 };
pos_T prev_pos; pos_T prev_pos;
pos_T *pos = NULL; // init for GCC pos_T *pos = NULL; // init for GCC
pos_T old_pos; // cursor position before command pos_T old_pos; // cursor position before command
int flag; int flag;
long n; long n;
@ -5749,7 +5749,7 @@ static void nv_brackets(cmdarg_T *cap)
if (vim_strchr((char_u *) if (vim_strchr((char_u *)
"iI\011dD\004", "iI\011dD\004",
cap->nchar) != NULL) { cap->nchar) != NULL) {
char_u *ptr; char_u *ptr;
size_t len; size_t len;
if ((len = find_ident_under_cursor(&ptr, FIND_IDENT)) == 0) { if ((len = find_ident_under_cursor(&ptr, FIND_IDENT)) == 0) {
@ -5993,7 +5993,7 @@ static void nv_brackets(cmdarg_T *cap)
*/ */
static void nv_percent(cmdarg_T *cap) static void nv_percent(cmdarg_T *cap)
{ {
pos_T *pos; pos_T *pos;
linenr_T lnum = curwin->w_cursor.lnum; linenr_T lnum = curwin->w_cursor.lnum;
cap->oap->inclusive = true; cap->oap->inclusive = true;
@ -6135,7 +6135,7 @@ static void nv_kundo(cmdarg_T *cap)
*/ */
static void nv_replace(cmdarg_T *cap) static void nv_replace(cmdarg_T *cap)
{ {
char_u *ptr; char_u *ptr;
int had_ctrl_v; int had_ctrl_v;
if (checkclearop(cap->oap)) { if (checkclearop(cap->oap)) {
@ -6554,7 +6554,7 @@ static void nv_optrans(cmdarg_T *cap)
*/ */
static void nv_gomark(cmdarg_T *cap) static void nv_gomark(cmdarg_T *cap)
{ {
pos_T *pos; pos_T *pos;
int c; int c;
pos_T old_cursor = curwin->w_cursor; pos_T old_cursor = curwin->w_cursor;
const bool old_KeyTyped = KeyTyped; // getting file may reset it const bool old_KeyTyped = KeyTyped; // getting file may reset it
@ -6593,7 +6593,7 @@ static void nv_gomark(cmdarg_T *cap)
// Handle CTRL-O, CTRL-I, "g;", "g,", and "CTRL-Tab" commands. // Handle CTRL-O, CTRL-I, "g;", "g,", and "CTRL-Tab" commands.
static void nv_pcmark(cmdarg_T *cap) static void nv_pcmark(cmdarg_T *cap)
{ {
pos_T *pos; pos_T *pos;
linenr_T lnum = curwin->w_cursor.lnum; linenr_T lnum = curwin->w_cursor.lnum;
const bool old_KeyTyped = KeyTyped; // getting file may reset it const bool old_KeyTyped = KeyTyped; // getting file may reset it
@ -6841,7 +6841,7 @@ static void nv_suspend(cmdarg_T *cap)
*/ */
static void nv_g_cmd(cmdarg_T *cap) static void nv_g_cmd(cmdarg_T *cap)
{ {
oparg_T *oap = cap->oap; oparg_T *oap = cap->oap;
pos_T tpos; pos_T tpos;
int i; int i;
bool flag = false; bool flag = false;
@ -7076,7 +7076,7 @@ static void nv_g_cmd(cmdarg_T *cap)
cap->oap->op_type == OP_NOP) == false) { cap->oap->op_type == OP_NOP) == false) {
clearopbeep(cap->oap); clearopbeep(cap->oap);
} else { } else {
char_u *ptr = get_cursor_line_ptr(); char_u *ptr = get_cursor_line_ptr();
// In Visual mode we may end up after the line. // In Visual mode we may end up after the line.
if (curwin->w_cursor.col > 0 && ptr[curwin->w_cursor.col] == NUL) { if (curwin->w_cursor.col > 0 && ptr[curwin->w_cursor.col] == NUL) {
@ -7734,7 +7734,7 @@ static void adjust_for_sel(cmdarg_T *cap)
*/ */
static bool unadjust_for_sel(void) static bool unadjust_for_sel(void)
{ {
pos_T *pp; pos_T *pp;
if (*p_sel == 'e' && !equalpos(VIsual, curwin->w_cursor)) { if (*p_sel == 'e' && !equalpos(VIsual, curwin->w_cursor)) {
if (lt(VIsual, curwin->w_cursor)) { if (lt(VIsual, curwin->w_cursor)) {
@ -8002,7 +8002,7 @@ static void nv_object(cmdarg_T *cap)
{ {
bool flag; bool flag;
bool include; bool include;
char_u *mps_save; char_u *mps_save;
if (cap->cmdchar == 'i') { if (cap->cmdchar == 'i') {
include = false; // "ix" = inner object: exclude white space include = false; // "ix" = inner object: exclude white space

View File

@ -73,7 +73,7 @@ struct block_def {
int startspaces; // 'extra' cols before first char int startspaces; // 'extra' cols before first char
int endspaces; // 'extra' cols after last char int endspaces; // 'extra' cols after last char
int textlen; // chars in block int textlen; // chars in block
char_u *textstart; // pointer to 1st char (partially) in block char_u *textstart; // pointer to 1st char (partially) in block
colnr_T textcol; // index of chars (partially) in block colnr_T textcol; // index of chars (partially) in block
colnr_T start_vcol; // start col of 1st char wholly inside block colnr_T start_vcol; // start col of 1st char wholly inside block
colnr_T end_vcol; // start col of 1st char wholly after block colnr_T end_vcol; // start col of 1st char wholly after block
@ -210,7 +210,7 @@ void op_shift(oparg_T *oap, int curs_top, int amount)
{ {
long i; long i;
int first_char; int first_char;
char_u *s; char_u *s;
int block_col = 0; int block_col = 0;
if (u_save((linenr_T)(oap->start.lnum - 1), if (u_save((linenr_T)(oap->start.lnum - 1),
@ -425,7 +425,7 @@ static void shift_block(oparg_T *oap, int amount)
size_t fill; // nr of spaces that replace a TAB size_t fill; // nr of spaces that replace a TAB
size_t new_line_len; // the length of the line after the size_t new_line_len; // the length of the line after the
// block shift // block shift
char_u *non_white = bd.textstart; char_u *non_white = bd.textstart;
/* /*
* Firstly, let's find the first non-whitespace character that is * Firstly, let's find the first non-whitespace character that is
@ -526,7 +526,7 @@ static void block_insert(oparg_T *oap, char_u *s, int b_insert, struct block_def
int spaces = 0; // non-zero if cutting a TAB int spaces = 0; // non-zero if cutting a TAB
colnr_T offset; // pointer along new line colnr_T offset; // pointer along new line
size_t s_len = STRLEN(s); size_t s_len = STRLEN(s);
char_u *newp, *oldp; // new, old lines char_u *newp, *oldp; // new, old lines
linenr_T lnum; // loop var linenr_T lnum; // loop var
int oldstate = State; int oldstate = State;
State = INSERT; // don't want REPLACE for State State = INSERT; // don't want REPLACE for State
@ -632,7 +632,7 @@ static void block_insert(oparg_T *oap, char_u *s, int b_insert, struct block_def
void op_reindent(oparg_T *oap, Indenter how) void op_reindent(oparg_T *oap, Indenter how)
{ {
long i; long i;
char_u *l; char_u *l;
int amount; int amount;
linenr_T first_changed = 0; linenr_T first_changed = 0;
linenr_T last_changed = 0; linenr_T last_changed = 0;
@ -709,7 +709,7 @@ void op_reindent(oparg_T *oap, Indenter how)
/* /*
* Keep the last expression line here, for repeating. * Keep the last expression line here, for repeating.
*/ */
static char_u *expr_line = NULL; static char_u *expr_line = NULL;
/* /*
* Get an expression for the "\"=expr1" or "CTRL-R =expr1" * Get an expression for the "\"=expr1" or "CTRL-R =expr1"
@ -717,7 +717,7 @@ static char_u *expr_line = NULL;
*/ */
int get_expr_register(void) int get_expr_register(void)
{ {
char_u *new_line; char_u *new_line;
new_line = getcmdline('=', 0L, 0, true); new_line = getcmdline('=', 0L, 0, true);
if (new_line == NULL) { if (new_line == NULL) {
@ -747,8 +747,8 @@ void set_expr_line(char_u *new_line)
*/ */
char_u *get_expr_line(void) char_u *get_expr_line(void)
{ {
char_u *expr_copy; char_u *expr_copy;
char_u *rv; char_u *rv;
static int nested = 0; static int nested = 0;
if (expr_line == NULL) { if (expr_line == NULL) {
@ -910,9 +910,9 @@ bool yank_register_mline(int regname)
*/ */
int do_record(int c) int do_record(int c)
{ {
char_u *p; char_u *p;
static int regname; static int regname;
yankreg_T *old_y_previous; yankreg_T *old_y_previous;
int retval; int retval;
if (reg_recording == 0) { if (reg_recording == 0) {
@ -1152,7 +1152,7 @@ static int put_in_typebuf(char_u *s, bool esc, bool colon, int silent)
retval = ins_typebuf((char_u *)"\n", REMAP_NONE, 0, true, silent); retval = ins_typebuf((char_u *)"\n", REMAP_NONE, 0, true, silent);
} }
if (retval == OK) { if (retval == OK) {
char_u *p; char_u *p;
if (esc) { if (esc) {
p = vim_strsave_escape_csi(s); p = vim_strsave_escape_csi(s);
@ -1417,8 +1417,8 @@ int op_delete(oparg_T *oap)
{ {
int n; int n;
linenr_T lnum; linenr_T lnum;
char_u *ptr; char_u *ptr;
char_u *newp, *oldp; char_u *newp, *oldp;
struct block_def bd = { 0 }; struct block_def bd = { 0 };
linenr_T old_lcount = curbuf->b_ml.ml_line_count; linenr_T old_lcount = curbuf->b_ml.ml_line_count;
@ -1670,7 +1670,7 @@ int op_delete(oparg_T *oap)
/* fix up things for virtualedit-delete: /* fix up things for virtualedit-delete:
* break the tabs which are going to get in our way * break the tabs which are going to get in our way
*/ */
char_u *curline = get_cursor_line_ptr(); char_u *curline = get_cursor_line_ptr();
int len = (int)STRLEN(curline); int len = (int)STRLEN(curline);
if (oap->end.coladd != 0 if (oap->end.coladd != 0
@ -1748,7 +1748,7 @@ setmarks:
*/ */
static void mb_adjust_opend(oparg_T *oap) static void mb_adjust_opend(oparg_T *oap)
{ {
char_u *p; char_u *p;
if (oap->inclusive) { if (oap->inclusive) {
p = ml_get(oap->end.lnum); p = ml_get(oap->end.lnum);
@ -1788,10 +1788,10 @@ int op_replace(oparg_T *oap, int c)
{ {
int n, numc; int n, numc;
int num_chars; int num_chars;
char_u *newp, *oldp; char_u *newp, *oldp;
colnr_T oldlen; colnr_T oldlen;
struct block_def bd; struct block_def bd;
char_u *after_p = NULL; char_u *after_p = NULL;
int had_ctrl_v_cr = false; 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) {
@ -2180,7 +2180,7 @@ bool swapchar(int op_type, pos_T *pos)
void op_insert(oparg_T *oap, long count1) void op_insert(oparg_T *oap, long count1)
{ {
long ins_len, pre_textlen = 0; long ins_len, pre_textlen = 0;
char_u *firstline, *ins_text; char_u *firstline, *ins_text;
colnr_T ind_pre = 0; colnr_T ind_pre = 0;
struct block_def bd; struct block_def bd;
int i; int i;
@ -2881,7 +2881,7 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
int delcount; int delcount;
int incr = 0; int incr = 0;
struct block_def bd; struct block_def bd;
char_u **y_array = NULL; char_u **y_array = NULL;
long nr_lines = 0; long nr_lines = 0;
pos_T new_cursor; pos_T new_cursor;
int indent; int indent;
@ -2890,7 +2890,7 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
int first_indent = TRUE; int first_indent = TRUE;
int lendiff = 0; int lendiff = 0;
pos_T old_pos; pos_T old_pos;
char_u *insert_string = NULL; char_u *insert_string = NULL;
bool allocated = false; bool allocated = false;
long cnt; long cnt;
@ -3762,7 +3762,7 @@ void ex_display(exarg_T *eap)
* display alternate file name * display alternate file name
*/ */
if ((arg == NULL || vim_strchr(arg, '%') != NULL) && !got_int) { if ((arg == NULL || vim_strchr(arg, '%') != NULL) && !got_int) {
char_u *fname; char_u *fname;
linenr_T dummy; linenr_T dummy;
if (buflist_name_nr(0, &fname, &dummy) != FAIL) { if (buflist_name_nr(0, &fname, &dummy) != FAIL) {
@ -3892,11 +3892,11 @@ char_u *skip_comment(char_u *line, bool process, bool include_space, bool *is_co
// return FAIL for failure, OK otherwise // return FAIL for failure, OK otherwise
int do_join(size_t count, int insert_space, int save_undo, int use_formatoptions, bool setmark) int do_join(size_t count, int insert_space, int save_undo, int use_formatoptions, bool setmark)
{ {
char_u *curr = NULL; char_u *curr = NULL;
char_u *curr_start = NULL; char_u *curr_start = NULL;
char_u *cend; char_u *cend;
char_u *newp; char_u *newp;
char_u *spaces; // number of spaces inserted before a line char_u *spaces; // number of spaces inserted before a line
int endcurr1 = NUL; int endcurr1 = NUL;
int endcurr2 = NUL; int endcurr2 = NUL;
int currsize = 0; // size of the current line int currsize = 0; // size of the current line
@ -3904,7 +3904,7 @@ int do_join(size_t count, int insert_space, int save_undo, int use_formatoptions
linenr_T t; linenr_T t;
colnr_T col = 0; colnr_T col = 0;
int ret = OK; int ret = OK;
int *comments = NULL; int *comments = NULL;
int remove_comments = (use_formatoptions == TRUE) int remove_comments = (use_formatoptions == TRUE)
&& has_format_option(FO_REMOVE_COMS); && has_format_option(FO_REMOVE_COMS);
bool prev_was_comment = false; bool prev_was_comment = false;
@ -4099,9 +4099,9 @@ static int same_leader(linenr_T lnum, int leader1_len, char_u *leader1_flags, in
char_u *leader2_flags) char_u *leader2_flags)
{ {
int idx1 = 0, idx2 = 0; int idx1 = 0, idx2 = 0;
char_u *p; char_u *p;
char_u *line1; char_u *line1;
char_u *line2; char_u *line2;
if (leader1_len == 0) { if (leader1_len == 0) {
return leader2_len == 0; return leader2_len == 0;
@ -4507,7 +4507,7 @@ void format_lines(linenr_T line_count, int avoid_fex)
*/ */
static int ends_in_white(linenr_T lnum) static int ends_in_white(linenr_T lnum)
{ {
char_u *s = ml_get(lnum); char_u *s = ml_get(lnum);
size_t l; size_t l;
if (*s == NUL) { if (*s == NUL) {
@ -4527,8 +4527,8 @@ static int ends_in_white(linenr_T lnum)
*/ */
static int fmt_check_par(linenr_T lnum, int *leader_len, char_u **leader_flags, int do_comments) static int fmt_check_par(linenr_T lnum, int *leader_len, char_u **leader_flags, int do_comments)
{ {
char_u *flags = NULL; // init for GCC char_u *flags = NULL; // init for GCC
char_u *ptr; char_u *ptr;
ptr = ml_get(lnum); ptr = ml_get(lnum);
if (do_comments) { if (do_comments) {
@ -4609,11 +4609,11 @@ int paragraph_start(linenr_T lnum)
static void block_prep(oparg_T *oap, struct block_def *bdp, linenr_T lnum, bool is_del) static void block_prep(oparg_T *oap, struct block_def *bdp, linenr_T lnum, bool is_del)
{ {
int incr = 0; int incr = 0;
char_u *pend; char_u *pend;
char_u *pstart; char_u *pstart;
char_u *line; char_u *line;
char_u *prev_pstart; char_u *prev_pstart;
char_u *prev_pend; char_u *prev_pend;
const int lbr_saved = curwin->w_p_lbr; const int lbr_saved = curwin->w_p_lbr;
// Avoid a problem with unwanted linebreaks in block mode. // Avoid a problem with unwanted linebreaks in block mode.
@ -4833,13 +4833,13 @@ void op_addsub(oparg_T *oap, linenr_T Prenum1, bool g_cmd)
int do_addsub(int op_type, pos_T *pos, int length, linenr_T Prenum1) int do_addsub(int op_type, pos_T *pos, int length, linenr_T Prenum1)
{ {
int col; int col;
char_u *buf1 = NULL; char_u *buf1 = NULL;
char_u buf2[NUMBUFLEN]; char_u buf2[NUMBUFLEN];
int pre; // 'X' or 'x': hex; '0': octal; 'B' or 'b': bin int pre; // 'X' or 'x': hex; '0': octal; 'B' or 'b': bin
static bool hexupper = false; // 0xABC static bool hexupper = false; // 0xABC
uvarnumber_T n; uvarnumber_T n;
uvarnumber_T oldn; uvarnumber_T oldn;
char_u *ptr; char_u *ptr;
int c; int c;
int todel; int todel;
int firstdigit; int firstdigit;
@ -5400,7 +5400,7 @@ void write_reg_contents_lst(int name, char_u **strings, bool must_append, Motion
colnr_T block_len) colnr_T block_len)
{ {
if (name == '/' || name == '=') { if (name == '/' || name == '=') {
char_u *s = strings[0]; char_u *s = strings[0];
if (strings[0] == NULL) { if (strings[0] == NULL) {
s = (char_u *)""; s = (char_u *)"";
} else if (strings[1] != NULL) { } else if (strings[1] != NULL) {
@ -5417,7 +5417,7 @@ void write_reg_contents_lst(int name, char_u **strings, bool must_append, Motion
return; return;
} }
yankreg_T *old_y_previous, *reg; yankreg_T *old_y_previous, *reg;
if (!(reg = init_write_reg(name, &old_y_previous, must_append))) { if (!(reg = init_write_reg(name, &old_y_previous, must_append))) {
return; return;
} }
@ -5506,7 +5506,7 @@ void write_reg_contents_ex(int name, const char_u *str, ssize_t len, bool must_a
return; return;
} }
yankreg_T *old_y_previous, *reg; yankreg_T *old_y_previous, *reg;
if (!(reg = init_write_reg(name, &old_y_previous, must_append))) { if (!(reg = init_write_reg(name, &old_y_previous, must_append))) {
return; return;
} }
@ -5680,7 +5680,7 @@ static varnumber_T line_count_info(char_u *line, varnumber_T *wc, varnumber_T *c
/// When "dict" is not NULL store the info there instead of showing it. /// When "dict" is not NULL store the info there instead of showing it.
void cursor_pos_info(dict_T *dict) void cursor_pos_info(dict_T *dict)
{ {
char_u *p; char_u *p;
char_u buf1[50]; char_u buf1[50];
char_u buf2[40]; char_u buf2[40];
linenr_T lnum; linenr_T lnum;
@ -5762,7 +5762,7 @@ void cursor_pos_info(dict_T *dict)
// Do extra processing for VIsual mode. // Do extra processing for VIsual mode.
if (l_VIsual_active if (l_VIsual_active
&& lnum >= min_pos.lnum && lnum <= max_pos.lnum) { && lnum >= min_pos.lnum && lnum <= max_pos.lnum) {
char_u *s = NULL; char_u *s = NULL;
long len = 0L; long len = 0L;
switch (l_VIsual_mode) { switch (l_VIsual_mode) {
@ -6155,7 +6155,7 @@ static bool get_clipboard(int name, yankreg_T **target, bool quiet)
reg->y_array[tv_idx++] = (char_u *)xstrdupnul((const char *)TV_LIST_ITEM_TV(li)->vval.v_string); reg->y_array[tv_idx++] = (char_u *)xstrdupnul((const char *)TV_LIST_ITEM_TV(li)->vval.v_string);
}); });
if (reg->y_size > 0 && strlen((char*)reg->y_array[reg->y_size-1]) == 0) { if (reg->y_size > 0 && strlen((char *)reg->y_array[reg->y_size-1]) == 0) {
// a known-to-be charwise yank might have a final linebreak // a known-to-be charwise yank might have a final linebreak
// but otherwise there is no line after the final newline // but otherwise there is no line after the final newline
if (reg->y_type != kMTCharWise) { if (reg->y_type != kMTCharWise) {

View File

@ -741,7 +741,7 @@ bool win_cursorline_standout(const win_T *wp)
*/ */
static void win_update(win_T *wp, Providers *providers) static void win_update(win_T *wp, Providers *providers)
{ {
buf_T *buf = wp->w_buffer; buf_T *buf = wp->w_buffer;
int type; int type;
int top_end = 0; /* Below last row of the top area that needs int top_end = 0; /* Below last row of the top area that needs
updating. 0 when no top area updating. */ updating. 0 when no top area updating. */
@ -1999,16 +1999,16 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
long vcol = 0; // virtual column (for tabs) long vcol = 0; // virtual column (for tabs)
long vcol_sbr = -1; // virtual column after showbreak long vcol_sbr = -1; // virtual column after showbreak
long vcol_prev = -1; // "vcol" of previous character long vcol_prev = -1; // "vcol" of previous character
char_u *line; // current line char_u *line; // current line
char_u *ptr; // current position in "line" char_u *ptr; // current position in "line"
int row; // row in the window, excl w_winrow int row; // row in the window, excl w_winrow
ScreenGrid *grid = &wp->w_grid; // grid specific to the window ScreenGrid *grid = &wp->w_grid; // grid specific to the window
char_u extra[57]; // sign, line number and 'fdc' must char_u extra[57]; // sign, line number and 'fdc' must
// fit in here // fit in here
int n_extra = 0; // number of extra chars int n_extra = 0; // number of extra chars
char_u *p_extra = NULL; // string of extra chars, plus NUL char_u *p_extra = NULL; // string of extra chars, plus NUL
char_u *p_extra_free = NULL; // p_extra needs to be freed char_u *p_extra_free = NULL; // p_extra needs to be freed
int c_extra = NUL; // extra chars, all the same int c_extra = NUL; // extra chars, all the same
int c_final = NUL; // final char, mandatory if set int c_final = NUL; // final char, mandatory if set
int extra_attr = 0; // attributes when n_extra != 0 int extra_attr = 0; // attributes when n_extra != 0
@ -2021,7 +2021,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
// saved "extra" items for when draw_state becomes WL_LINE (again) // saved "extra" items for when draw_state becomes WL_LINE (again)
int saved_n_extra = 0; int saved_n_extra = 0;
char_u *saved_p_extra = NULL; char_u *saved_p_extra = NULL;
int saved_c_extra = 0; int saved_c_extra = 0;
int saved_c_final = 0; int saved_c_final = 0;
int saved_char_attr = 0; int saved_char_attr = 0;
@ -2090,7 +2090,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
int line_attr_lowprio = 0; // low-priority attribute for the line int line_attr_lowprio = 0; // low-priority attribute for the line
int line_attr_lowprio_save; int line_attr_lowprio_save;
matchitem_T *cur; // points to the match list matchitem_T *cur; // points to the match list
match_T *shl; // points to search_hl or a match match_T *shl; // points to search_hl or a match
bool shl_flag; // flag to indicate whether search_hl bool shl_flag; // flag to indicate whether search_hl
// has been processed or not // has been processed or not
bool prevcol_hl_flag; // flag to indicate whether prevcol bool prevcol_hl_flag; // flag to indicate whether prevcol
@ -2502,7 +2502,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
v = wp->w_leftcol; v = wp->w_leftcol;
} }
if (v > 0 && !number_only) { if (v > 0 && !number_only) {
char_u *prev_ptr = ptr; char_u *prev_ptr = ptr;
while (vcol < v && *ptr != NUL) { while (vcol < v && *ptr != NUL) {
c = win_lbr_chartabsize(wp, line, ptr, (colnr_T)vcol, NULL); c = win_lbr_chartabsize(wp, line, ptr, (colnr_T)vcol, NULL);
vcol += c; vcol += c;
@ -4802,7 +4802,7 @@ static void grid_put_linebuf(ScreenGrid *grid, int row, int coloff, int endcol,
*/ */
void rl_mirror(char_u *str) void rl_mirror(char_u *str)
{ {
char_u *p1, *p2; char_u *p1, *p2;
int t; int t;
for (p1 = str, p2 = str + STRLEN(str) - 1; p1 < p2; ++p1, --p2) { for (p1 = str, p2 = str + STRLEN(str) - 1; p1 < p2; ++p1, --p2) {
@ -4953,19 +4953,19 @@ void win_redr_status_matches(expand_T *xp, int num_matches, char_u **matches, in
{ {
#define L_MATCH(m) (showtail ? sm_gettail(matches[m], false) : matches[m]) #define L_MATCH(m) (showtail ? sm_gettail(matches[m], false) : matches[m])
int row; int row;
char_u *buf; char_u *buf;
int len; int len;
int clen; // length in screen cells int clen; // length in screen cells
int fillchar; int fillchar;
int attr; int attr;
int i; int i;
bool highlight = true; bool highlight = true;
char_u *selstart = NULL; char_u *selstart = NULL;
int selstart_col = 0; int selstart_col = 0;
char_u *selend = NULL; char_u *selend = NULL;
static int first_match = 0; static int first_match = 0;
bool add_left = false; bool add_left = false;
char_u *s; char_u *s;
int emenu; int emenu;
int l; int l;
@ -5135,7 +5135,7 @@ void win_redr_status_matches(expand_T *xp, int num_matches, char_u **matches, in
static void win_redr_status(win_T *wp) static void win_redr_status(win_T *wp)
{ {
int row; int row;
char_u *p; char_u *p;
int len; int len;
int fillchar; int fillchar;
int attr; int attr;
@ -5283,7 +5283,7 @@ static void redraw_custom_statusline(win_T *wp)
/// line of the window right of it. If not, then it's a vertical separator. /// line of the window right of it. If not, then it's a vertical separator.
bool stl_connected(win_T *wp) bool stl_connected(win_T *wp)
{ {
frame_T *fr; frame_T *fr;
fr = wp->w_frame; fr = wp->w_frame;
while (fr->fr_parent != NULL) { while (fr->fr_parent != NULL) {
@ -5309,16 +5309,16 @@ bool stl_connected(win_T *wp)
/// @param len length of buffer /// @param len length of buffer
bool get_keymap_str(win_T *wp, char_u *fmt, char_u *buf, int len) bool get_keymap_str(win_T *wp, char_u *fmt, char_u *buf, int len)
{ {
char_u *p; char_u *p;
if (wp->w_buffer->b_p_iminsert != B_IMODE_LMAP) { if (wp->w_buffer->b_p_iminsert != B_IMODE_LMAP) {
return false; return false;
} }
{ {
buf_T *old_curbuf = curbuf; buf_T *old_curbuf = curbuf;
win_T *old_curwin = curwin; win_T *old_curwin = curwin;
char_u *s; char_u *s;
curbuf = wp->w_buffer; curbuf = wp->w_buffer;
curwin = wp; curwin = wp;
@ -5360,12 +5360,12 @@ static void win_redr_custom(win_T *wp, bool draw_ruler)
int len; int len;
int fillchar; int fillchar;
char_u buf[MAXPATHL]; char_u buf[MAXPATHL];
char_u *stl; char_u *stl;
char_u *p; char_u *p;
stl_hlrec_t *hltab; stl_hlrec_t *hltab;
StlClickRecord *tabtab; StlClickRecord *tabtab;
int use_sandbox = false; int use_sandbox = false;
win_T *ewp; win_T *ewp;
int p_crb_save; int p_crb_save;
ScreenGrid *grid = &default_grid; ScreenGrid *grid = &default_grid;
@ -5734,7 +5734,7 @@ void grid_put_schar(ScreenGrid *grid, int row, int col, char_u *schar, int attr)
void grid_puts_len(ScreenGrid *grid, char_u *text, int textlen, int row, int col, int attr) void grid_puts_len(ScreenGrid *grid, char_u *text, int textlen, int row, int col, int attr)
{ {
unsigned off; unsigned off;
char_u *ptr = text; char_u *ptr = text;
int len = textlen; int len = textlen;
int c; int c;
unsigned max_off; unsigned max_off;
@ -5962,7 +5962,7 @@ static void prepare_search_hl(win_T *wp, linenr_T lnum)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_ALL
{ {
matchitem_T *cur; // points to the match list matchitem_T *cur; // points to the match list
match_T *shl; // points to search_hl or a match match_T *shl; // points to search_hl or a match
bool shl_flag; // flag to indicate whether search_hl bool shl_flag; // flag to indicate whether search_hl
// has been processed or not // has been processed or not
@ -6077,7 +6077,7 @@ static void next_search_hl(win_T *win, match_T *shl, linenr_T lnum, colnr_T minc
} else if (vim_strchr(p_cpo, CPO_SEARCH) == NULL } else if (vim_strchr(p_cpo, CPO_SEARCH) == NULL
|| (shl->rm.endpos[0].lnum == 0 || (shl->rm.endpos[0].lnum == 0
&& shl->rm.endpos[0].col <= shl->rm.startpos[0].col)) { && shl->rm.endpos[0].col <= shl->rm.startpos[0].col)) {
char_u *ml; char_u *ml;
matchcol = shl->rm.startpos[0].col; matchcol = shl->rm.startpos[0].col;
ml = ml_get_buf(shl->buf, lnum, false) + matchcol; ml = ml_get_buf(shl->buf, lnum, false) + matchcol;
@ -7082,15 +7082,15 @@ void draw_tabline(void)
int col = 0; int col = 0;
int scol = 0; int scol = 0;
int attr; int attr;
win_T *wp; win_T *wp;
win_T *cwp; win_T *cwp;
int wincount; int wincount;
int modified; int modified;
int c; int c;
int len; int len;
int attr_nosel = HL_ATTR(HLF_TP); int attr_nosel = HL_ATTR(HLF_TP);
int attr_fill = HL_ATTR(HLF_TPF); int attr_fill = HL_ATTR(HLF_TPF);
char_u *p; char_u *p;
int room; int room;
int use_sep_chars = (t_colors < 8 int use_sep_chars = (t_colors < 8
); );

File diff suppressed because it is too large Load Diff

View File

@ -73,8 +73,8 @@ static char *m_onlyone = N_("Already only one window");
void do_window(int nchar, long Prenum, int xchar) void do_window(int nchar, long Prenum, int xchar)
{ {
long Prenum1; long Prenum1;
win_T *wp; win_T *wp;
char_u *ptr; char_u *ptr;
linenr_T lnum = -1; linenr_T lnum = -1;
int type = FIND_DEFINE; int type = FIND_DEFINE;
size_t len; size_t len;
@ -287,8 +287,8 @@ newwindow:
if (one_window()) { if (one_window()) {
MSG(_(m_onlyone)); MSG(_(m_onlyone));
} else { } else {
tabpage_T *oldtab = curtab; tabpage_T *oldtab = curtab;
tabpage_T *newtab; tabpage_T *newtab;
/* First create a new tab with the window, then go back to /* First create a new tab with the window, then go back to
* the old tab and close the window there. */ * the old tab and close the window there. */
@ -900,8 +900,8 @@ int win_split(int size, int flags)
*/ */
int win_split_ins(int size, int flags, win_T *new_wp, int dir) int win_split_ins(int size, int flags, win_T *new_wp, int dir)
{ {
win_T *wp = new_wp; win_T *wp = new_wp;
win_T *oldwin; win_T *oldwin;
int new_size = size; int new_size = size;
int i; int i;
int need_status = 0; int need_status = 0;
@ -910,7 +910,7 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
int available; int available;
int oldwin_height = 0; int oldwin_height = 0;
int layout; int layout;
frame_T *frp, *curfrp, *frp2, *prevfrp; frame_T *frp, *curfrp, *frp2, *prevfrp;
int before; int before;
int minheight; int minheight;
int wmh1; int wmh1;
@ -1607,10 +1607,10 @@ int make_windows(int count, bool vertical)
*/ */
static void win_exchange(long Prenum) static void win_exchange(long Prenum)
{ {
frame_T *frp; frame_T *frp;
frame_T *frp2; frame_T *frp2;
win_T *wp; win_T *wp;
win_T *wp2; win_T *wp2;
int temp; int temp;
if (curwin->w_floating) { if (curwin->w_floating) {
@ -1706,9 +1706,9 @@ static void win_exchange(long Prenum)
// if upwards false the first window becomes the second one // if upwards false the first window becomes the second one
static void win_rotate(bool upwards, int count) static void win_rotate(bool upwards, int count)
{ {
win_T *wp1; win_T *wp1;
win_T *wp2; win_T *wp2;
frame_T *frp; frame_T *frp;
int n; int n;
if (curwin->w_floating) { if (curwin->w_floating) {
@ -1918,7 +1918,7 @@ static void win_equal_rec(win_T *next_curwin, bool current, frame_T *topfr, int
int n, m; int n, m;
int extra_sep = 0; int extra_sep = 0;
int wincount, totwincount = 0; int wincount, totwincount = 0;
frame_T *fr; frame_T *fr;
int next_curwin_size = 0; int next_curwin_size = 0;
int room = 0; int room = 0;
int new_size; int new_size;
@ -2205,7 +2205,7 @@ static void win_equal_rec(win_T *next_curwin, bool current, frame_T *topfr, int
/// @param keep_curwin don't close `curwin` /// @param keep_curwin don't close `curwin`
void close_windows(buf_T *buf, int keep_curwin) void close_windows(buf_T *buf, int keep_curwin)
{ {
tabpage_T *tp, *nexttp; tabpage_T *tp, *nexttp;
int h = tabline_height(); int h = tabline_height();
++RedrawingDisabled; ++RedrawingDisabled;
@ -2305,7 +2305,7 @@ static bool close_last_window_tabpage(win_T *win, bool free_buf, tabpage_T *prev
if (!ONE_WINDOW) { if (!ONE_WINDOW) {
return false; return false;
} }
buf_T *old_curbuf = curbuf; buf_T *old_curbuf = curbuf;
Terminal *term = win->w_buffer ? win->w_buffer->terminal : NULL; Terminal *term = win->w_buffer ? win->w_buffer->terminal : NULL;
if (term) { if (term) {
@ -2356,12 +2356,12 @@ static bool close_last_window_tabpage(win_T *win, bool free_buf, tabpage_T *prev
// Returns FAIL when the window was not closed. // Returns FAIL when the window was not closed.
int win_close(win_T *win, bool free_buf) int win_close(win_T *win, bool free_buf)
{ {
win_T *wp; win_T *wp;
bool other_buffer = false; bool other_buffer = false;
bool close_curwin = false; bool close_curwin = false;
int dir; int dir;
bool help_window = false; bool help_window = false;
tabpage_T *prev_curtab = curtab; tabpage_T *prev_curtab = curtab;
frame_T *win_frame = win->w_floating ? NULL : win->w_frame->fr_parent; frame_T *win_frame = win->w_floating ? NULL : win->w_frame->fr_parent;
const bool had_diffmode = win->w_p_diff; const bool had_diffmode = win->w_p_diff;
@ -2651,7 +2651,7 @@ static void do_autocmd_winclosed(win_T *win)
void win_close_othertab(win_T *win, int free_buf, tabpage_T *tp) void win_close_othertab(win_T *win, int free_buf, tabpage_T *tp)
{ {
int dir; int dir;
tabpage_T *ptp = NULL; tabpage_T *ptp = NULL;
bool free_tp = false; bool free_tp = false;
// Get here with win->w_buffer == NULL when win_close() detects the tab page // Get here with win->w_buffer == NULL when win_close() detects the tab page
@ -2739,8 +2739,8 @@ void win_close_othertab(win_T *win, int free_buf, tabpage_T *tp)
/// @return a pointer to the window that got the freed up space. /// @return a pointer to the window that got the freed up space.
static win_T *win_free_mem(win_T *win, int *dirp, tabpage_T *tp) static win_T *win_free_mem(win_T *win, int *dirp, tabpage_T *tp)
{ {
frame_T *frp; frame_T *frp;
win_T *wp; win_T *wp;
if (!win->w_floating) { if (!win->w_floating) {
// Remove the window and its frame from the tree of frames. // Remove the window and its frame from the tree of frames.
@ -2812,9 +2812,9 @@ void win_free_all(void)
/// @return a pointer to the window that got the freed up space. /// @return a pointer to the window that got the freed up space.
win_T *winframe_remove(win_T *win, int *dirp, tabpage_T *tp) win_T *winframe_remove(win_T *win, int *dirp, tabpage_T *tp)
{ {
frame_T *frp, *frp2, *frp3; frame_T *frp, *frp2, *frp3;
frame_T *frp_close = win->w_frame; frame_T *frp_close = win->w_frame;
win_T *wp; win_T *wp;
/* /*
* If there is only one window there is nothing to remove. * If there is only one window there is nothing to remove.
@ -2963,7 +2963,7 @@ win_T *winframe_remove(win_T *win, int *dirp, tabpage_T *tp)
/// is left over after "win" is closed. /// is left over after "win" is closed.
static frame_T *win_altframe(win_T *win, tabpage_T *tp) static frame_T *win_altframe(win_T *win, tabpage_T *tp)
{ {
frame_T *frp; frame_T *frp;
if (tp == NULL ? ONE_WINDOW : tp->tp_firstwin == tp->tp_lastwin) { if (tp == NULL ? ONE_WINDOW : tp->tp_firstwin == tp->tp_lastwin) {
return alt_tabpage()->tp_curwin->w_frame; return alt_tabpage()->tp_curwin->w_frame;
@ -3005,7 +3005,7 @@ static frame_T *win_altframe(win_T *win, tabpage_T *tp)
*/ */
static tabpage_T *alt_tabpage(void) static tabpage_T *alt_tabpage(void)
{ {
tabpage_T *tp; tabpage_T *tp;
// Use the next tab page if possible. // Use the next tab page if possible.
if (curtab->tp_next != NULL) { if (curtab->tp_next != NULL) {
@ -3058,7 +3058,7 @@ static bool frame_has_win(const frame_T *frp, const win_T *wp)
static void frame_new_height(frame_T *topfrp, int height, bool topfirst, bool wfh) static void frame_new_height(frame_T *topfrp, int height, bool topfirst, bool wfh)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_ALL
{ {
frame_T *frp; frame_T *frp;
int extra_lines; int extra_lines;
int h; int h;
@ -3214,7 +3214,7 @@ static bool frame_fixed_width(frame_T *frp)
*/ */
static void frame_add_statusline(frame_T *frp) static void frame_add_statusline(frame_T *frp)
{ {
win_T *wp; win_T *wp;
if (frp->fr_layout == FR_LEAF) { if (frp->fr_layout == FR_LEAF) {
wp = frp->fr_win; wp = frp->fr_win;
@ -3246,10 +3246,10 @@ static void frame_add_statusline(frame_T *frp)
/// may cause the width not to be set. /// may cause the width not to be set.
static void frame_new_width(frame_T *topfrp, int width, bool leftfirst, bool wfw) static void frame_new_width(frame_T *topfrp, int width, bool leftfirst, bool wfw)
{ {
frame_T *frp; frame_T *frp;
int extra_cols; int extra_cols;
int w; int w;
win_T *wp; win_T *wp;
if (topfrp->fr_layout == FR_LEAF) { if (topfrp->fr_layout == FR_LEAF) {
// Simple case: just one window. // Simple case: just one window.
@ -3345,7 +3345,7 @@ static void frame_new_width(frame_T *topfrp, int width, bool leftfirst, bool wfw
static void frame_add_vsep(const frame_T *frp) static void frame_add_vsep(const frame_T *frp)
FUNC_ATTR_NONNULL_ARG(1) FUNC_ATTR_NONNULL_ARG(1)
{ {
win_T *wp; win_T *wp;
if (frp->fr_layout == FR_LEAF) { if (frp->fr_layout == FR_LEAF) {
wp = frp->fr_win; wp = frp->fr_win;
@ -3397,7 +3397,7 @@ static void frame_fix_height(win_T *wp)
*/ */
static int frame_minheight(frame_T *topfrp, win_T *next_curwin) static int frame_minheight(frame_T *topfrp, win_T *next_curwin)
{ {
frame_T *frp; frame_T *frp;
int m; int m;
int n; int n;
@ -3442,7 +3442,7 @@ static int frame_minheight(frame_T *topfrp, win_T *next_curwin)
/// @param next_curwin use p_wh and p_wiw for next_curwin /// @param next_curwin use p_wh and p_wiw for next_curwin
static int frame_minwidth(frame_T *topfrp, win_T *next_curwin) static int frame_minwidth(frame_T *topfrp, win_T *next_curwin)
{ {
frame_T *frp; frame_T *frp;
int m, n; int m, n;
if (topfrp->fr_win != NULL) { if (topfrp->fr_win != NULL) {
@ -3486,8 +3486,8 @@ static int frame_minwidth(frame_T *topfrp, win_T *next_curwin)
/// @param forceit always hide all other windows /// @param forceit always hide all other windows
void close_others(int message, int forceit) void close_others(int message, int forceit)
{ {
win_T *wp; win_T *wp;
win_T *nextwp; win_T *nextwp;
int r; int r;
if (curwin->w_floating) { if (curwin->w_floating) {
@ -3715,8 +3715,8 @@ void free_tabpage(tabpage_T *tp)
/// @return Was the new tabpage created successfully? FAIL or OK. /// @return Was the new tabpage created successfully? FAIL or OK.
int win_new_tabpage(int after, char_u *filename) int win_new_tabpage(int after, char_u *filename)
{ {
tabpage_T *old_curtab = curtab; tabpage_T *old_curtab = curtab;
tabpage_T *newtp; tabpage_T *newtp;
int n; int n;
newtp = alloc_tabpage(); newtp = alloc_tabpage();
@ -3740,7 +3740,7 @@ int win_new_tabpage(int after, char_u *filename)
newtp->tp_next = first_tabpage; newtp->tp_next = first_tabpage;
first_tabpage = newtp; first_tabpage = newtp;
} else { } else {
tabpage_T *tp = old_curtab; tabpage_T *tp = old_curtab;
if (after > 0) { if (after > 0) {
// Put new tab page before tab page "after". // Put new tab page before tab page "after".
@ -3887,7 +3887,7 @@ void close_tabpage(tabpage_T *tab)
*/ */
tabpage_T *find_tabpage(int n) tabpage_T *find_tabpage(int n)
{ {
tabpage_T *tp; tabpage_T *tp;
int i = 1; int i = 1;
for (tp = first_tabpage; tp != NULL && i != n; tp = tp->tp_next) { for (tp = first_tabpage; tp != NULL && i != n; tp = tp->tp_next) {
@ -3903,7 +3903,7 @@ tabpage_T *find_tabpage(int n)
int tabpage_index(tabpage_T *ftp) int tabpage_index(tabpage_T *ftp)
{ {
int i = 1; int i = 1;
tabpage_T *tp; tabpage_T *tp;
for (tp = first_tabpage; tp != NULL && tp != ftp; tp = tp->tp_next) { for (tp = first_tabpage; tp != NULL && tp != ftp; tp = tp->tp_next) {
++i; ++i;
@ -3921,7 +3921,7 @@ int tabpage_index(tabpage_T *ftp)
/// @param trigger_leave_autocmds when true trigger *Leave autocommands. /// @param trigger_leave_autocmds when true trigger *Leave autocommands.
static int leave_tabpage(buf_T *new_curbuf, bool trigger_leave_autocmds) static int leave_tabpage(buf_T *new_curbuf, bool trigger_leave_autocmds)
{ {
tabpage_T *tp = curtab; tabpage_T *tp = curtab;
reset_VIsual_and_resel(); // stop Visual mode reset_VIsual_and_resel(); // stop Visual mode
if (trigger_leave_autocmds) { if (trigger_leave_autocmds) {
@ -3960,7 +3960,7 @@ static void enter_tabpage(tabpage_T *tp, buf_T *old_curbuf, bool trigger_enter_a
bool trigger_leave_autocmds) bool trigger_leave_autocmds)
{ {
int old_off = tp->tp_firstwin->w_winrow; int old_off = tp->tp_firstwin->w_winrow;
win_T *next_prevwin = tp->tp_prevwin; win_T *next_prevwin = tp->tp_prevwin;
tabpage_T *old_curtab = curtab; tabpage_T *old_curtab = curtab;
curtab = tp; curtab = tp;
@ -4055,8 +4055,8 @@ static void tabpage_check_windows(tabpage_T *old_curtab)
*/ */
void goto_tabpage(int n) void goto_tabpage(int n)
{ {
tabpage_T *tp = NULL; // shut up compiler tabpage_T *tp = NULL; // shut up compiler
tabpage_T *ttp; tabpage_T *ttp;
int i; int i;
if (text_locked()) { if (text_locked()) {
@ -4215,7 +4215,7 @@ void tabpage_move(int nr)
*/ */
void win_goto(win_T *wp) void win_goto(win_T *wp)
{ {
win_T *owp = curwin; win_T *owp = curwin;
if (text_locked()) { if (text_locked()) {
beep_flush(); beep_flush();
@ -4268,9 +4268,9 @@ tabpage_T *win_find_tabpage(win_T *win)
/// @return found window /// @return found window
win_T *win_vert_neighbor(tabpage_T *tp, win_T *wp, bool up, long count) win_T *win_vert_neighbor(tabpage_T *tp, win_T *wp, bool up, long count)
{ {
frame_T *fr; frame_T *fr;
frame_T *nfr; frame_T *nfr;
frame_T *foundfr; frame_T *foundfr;
foundfr = wp->w_frame; foundfr = wp->w_frame;
@ -4351,9 +4351,9 @@ static void win_goto_ver(bool up, long count)
/// @return found window /// @return found window
win_T *win_horz_neighbor(tabpage_T *tp, win_T *wp, bool left, long count) win_T *win_horz_neighbor(tabpage_T *tp, win_T *wp, bool left, long count)
{ {
frame_T *fr; frame_T *fr;
frame_T *nfr; frame_T *nfr;
frame_T *foundfr; frame_T *foundfr;
foundfr = wp->w_frame; foundfr = wp->w_frame;
@ -4704,7 +4704,7 @@ void free_wininfo(wininfo_T *wip, buf_T *bp)
static void win_free(win_T *wp, tabpage_T *tp) static void win_free(win_T *wp, tabpage_T *tp)
{ {
int i; int i;
wininfo_T *wip; wininfo_T *wip;
pmap_del(handle_T)(&window_handles, wp->handle); pmap_del(handle_T)(&window_handles, wp->handle);
clearFolding(wp); clearFolding(wp);
@ -4813,7 +4813,7 @@ void win_free_grid(win_T *wp, bool reinit)
*/ */
void win_append(win_T *after, win_T *wp) void win_append(win_T *after, win_T *wp)
{ {
win_T *before; win_T *before;
if (after == NULL) { // after NULL is in front of the first if (after == NULL) { // after NULL is in front of the first
before = firstwin; before = firstwin;
@ -5054,8 +5054,8 @@ void win_reconfig_floats(void)
*/ */
static void frame_comp_pos(frame_T *topfrp, int *row, int *col) static void frame_comp_pos(frame_T *topfrp, int *row, int *col)
{ {
win_T *wp; win_T *wp;
frame_T *frp; frame_T *frp;
int startcol; int startcol;
int startrow; int startrow;
@ -5156,7 +5156,7 @@ static void frame_setheight(frame_T *curfrp, int height)
int take; // number of lines taken from other windows int take; // number of lines taken from other windows
int room_cmdline; // lines available from cmdline int room_cmdline; // lines available from cmdline
int run; int run;
frame_T *frp; frame_T *frp;
int h; int h;
int room_reserved; int room_reserved;
@ -5353,7 +5353,7 @@ static void frame_setwidth(frame_T *curfrp, int width)
int room; // total number of lines available int room; // total number of lines available
int take; // number of lines taken from other windows int take; // number of lines taken from other windows
int run; int run;
frame_T *frp; frame_T *frp;
int w; int w;
int room_reserved; int room_reserved;
@ -5520,8 +5520,8 @@ void win_setminwidth(void)
/// Status line of dragwin is dragged "offset" lines down (negative is up). /// Status line of dragwin is dragged "offset" lines down (negative is up).
void win_drag_status_line(win_T *dragwin, int offset) void win_drag_status_line(win_T *dragwin, int offset)
{ {
frame_T *curfr; frame_T *curfr;
frame_T *fr; frame_T *fr;
int room; int room;
int row; int row;
bool up; // if true, drag status line up, otherwise down bool up; // if true, drag status line up, otherwise down
@ -5647,8 +5647,8 @@ void win_drag_status_line(win_T *dragwin, int offset)
*/ */
void win_drag_vsep_line(win_T *dragwin, int offset) void win_drag_vsep_line(win_T *dragwin, int offset)
{ {
frame_T *curfr; frame_T *curfr;
frame_T *fr; frame_T *fr;
int room; int room;
bool left; // if true, drag separator line left, otherwise right bool left; // if true, drag separator line left, otherwise right
int n; int n;
@ -5980,7 +5980,7 @@ void win_comp_scroll(win_T *wp)
void command_height(void) void command_height(void)
{ {
int h; int h;
frame_T *frp; frame_T *frp;
int old_p_ch = curtab->tp_ch_used; int old_p_ch = curtab->tp_ch_used;
/* Use the value of p_ch that we remembered. This is needed for when the /* Use the value of p_ch that we remembered. This is needed for when the
@ -6072,7 +6072,7 @@ char_u *grab_file_name(long count, linenr_T *file_lnum)
int options = FNAME_MESS | FNAME_EXP | FNAME_REL | FNAME_UNESC; int options = FNAME_MESS | FNAME_EXP | FNAME_REL | FNAME_UNESC;
if (VIsual_active) { if (VIsual_active) {
size_t len; size_t len;
char_u *ptr; char_u *ptr;
if (get_visual_text(NULL, &ptr, &len) == FAIL) { if (get_visual_text(NULL, &ptr, &len) == FAIL) {
return NULL; return NULL;
} }
@ -6114,7 +6114,7 @@ char_u *file_name_at_cursor(int options, long count, linenr_T *file_lnum)
char_u *file_name_in_line(char_u *line, int col, int options, long count, char_u *rel_fname, char_u *file_name_in_line(char_u *line, int col, int options, long count, char_u *rel_fname,
linenr_T *file_lnum) linenr_T *file_lnum)
{ {
char_u *ptr; char_u *ptr;
size_t len; size_t len;
bool in_type = true; bool in_type = true;
bool is_url = false; bool is_url = false;
@ -6226,8 +6226,8 @@ void last_status(bool morewin)
static void last_status_rec(frame_T *fr, bool statusline) static void last_status_rec(frame_T *fr, bool statusline)
{ {
frame_T *fp; frame_T *fp;
win_T *wp; win_T *wp;
if (fr->fr_layout == FR_LEAF) { if (fr->fr_layout == FR_LEAF) {
wp = fr->fr_win; wp = fr->fr_win;
@ -6444,7 +6444,7 @@ static void clear_snapshot_rec(frame_T *fr)
/// @param close_curwin closing current window /// @param close_curwin closing current window
void restore_snapshot(int idx, int close_curwin) void restore_snapshot(int idx, int close_curwin)
{ {
win_T *wp; win_T *wp;
if (curtab->tp_snapshot[idx] != NULL if (curtab->tp_snapshot[idx] != NULL
&& curtab->tp_snapshot[idx]->fr_width == topframe->fr_width && curtab->tp_snapshot[idx]->fr_width == topframe->fr_width
@ -6484,8 +6484,8 @@ static int check_snapshot_rec(frame_T *sn, frame_T *fr)
*/ */
static win_T *restore_snapshot_rec(frame_T *sn, frame_T *fr) static win_T *restore_snapshot_rec(frame_T *sn, frame_T *fr)
{ {
win_T *wp = NULL; win_T *wp = NULL;
win_T *wp2; win_T *wp2;
fr->fr_height = sn->fr_height; fr->fr_height = sn->fr_height;
fr->fr_width = sn->fr_width; fr->fr_width = sn->fr_width;
@ -6645,7 +6645,7 @@ int match_add(win_T *wp, const char *const grp, const char *const pat, int prio,
matchitem_T *prev; matchitem_T *prev;
matchitem_T *m; matchitem_T *m;
int hlg_id; int hlg_id;
regprog_T *regprog = NULL; regprog_T *regprog = NULL;
int rtype = SOME_VALID; int rtype = SOME_VALID;
if (*grp == NUL || (pat != NULL && *pat == NUL)) { if (*grp == NUL || (pat != NULL && *pat == NUL)) {