mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 22:18:33 +00:00
refactor: follow style guide
This commit is contained in:
@@ -190,8 +190,8 @@ static void restore_dbg_stuff(struct dbg_stuff *dsp)
|
||||
trylevel = dsp->trylevel;
|
||||
force_abort = dsp->force_abort;
|
||||
caught_stack = dsp->caught_stack;
|
||||
(void)v_exception(dsp->vv_exception);
|
||||
(void)v_throwpoint(dsp->vv_throwpoint);
|
||||
v_exception(dsp->vv_exception);
|
||||
v_throwpoint(dsp->vv_throwpoint);
|
||||
did_emsg = dsp->did_emsg;
|
||||
got_int = dsp->got_int;
|
||||
did_throw = dsp->did_throw;
|
||||
@@ -710,7 +710,7 @@ int do_cmdline(char *cmdline, LineGetter fgetline, void *cookie, int flags)
|
||||
}
|
||||
|
||||
// Convert an interrupt to an exception if appropriate.
|
||||
(void)do_intthrow(&cstack);
|
||||
do_intthrow(&cstack);
|
||||
|
||||
// Continue executing command lines when:
|
||||
// - no CTRL-C typed, no aborting error, no exception thrown or try
|
||||
@@ -1703,8 +1703,8 @@ int execute_cmd(exarg_T *eap, CmdParseInfo *cmdinfo, bool preview)
|
||||
&& eap->addr_type == ADDR_LINES) {
|
||||
// Put the first line at the start of a closed fold, put the last line
|
||||
// at the end of a closed fold.
|
||||
(void)hasFolding(eap->line1, &eap->line1, NULL);
|
||||
(void)hasFolding(eap->line2, NULL, &eap->line2);
|
||||
hasFolding(eap->line1, &eap->line1, NULL);
|
||||
hasFolding(eap->line2, NULL, &eap->line2);
|
||||
}
|
||||
|
||||
// Use first argument as count when possible
|
||||
@@ -1958,7 +1958,7 @@ static char *do_one_cmd(char **cmdlinep, int flags, cstack_T *cstack, LineGetter
|
||||
}
|
||||
if (!ea.skip && got_int) {
|
||||
ea.skip = true;
|
||||
(void)do_intthrow(cstack);
|
||||
do_intthrow(cstack);
|
||||
}
|
||||
|
||||
// 4. Parse a range specifier of the form: addr [,addr] [;addr] ..
|
||||
@@ -2170,8 +2170,8 @@ static char *do_one_cmd(char **cmdlinep, int flags, cstack_T *cstack, LineGetter
|
||||
&& ea.addr_type == ADDR_LINES) {
|
||||
// Put the first line at the start of a closed fold, put the last line
|
||||
// at the end of a closed fold.
|
||||
(void)hasFolding(ea.line1, &ea.line1, NULL);
|
||||
(void)hasFolding(ea.line2, NULL, &ea.line2);
|
||||
hasFolding(ea.line1, &ea.line1, NULL);
|
||||
hasFolding(ea.line2, NULL, &ea.line2);
|
||||
}
|
||||
|
||||
// For the ":make" and ":grep" commands we insert the 'makeprg'/'grepprg'
|
||||
@@ -3259,7 +3259,7 @@ static const char *addr_error(cmd_addr_T addr_type)
|
||||
/// @param errormsg Error message, if any
|
||||
///
|
||||
/// @return MAXLNUM when no Ex address was found.
|
||||
static linenr_T get_address(exarg_T *eap, char **ptr, cmd_addr_T addr_type, int skip, bool silent,
|
||||
static linenr_T get_address(exarg_T *eap, char **ptr, cmd_addr_T addr_type, bool skip, bool silent,
|
||||
int to_other_file, int address_count, const char **errormsg)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
@@ -3379,7 +3379,7 @@ static linenr_T get_address(exarg_T *eap, char **ptr, cmd_addr_T addr_type, int
|
||||
fmark_T *fm = mark_get(curbuf, curwin, NULL, flag, *cmd);
|
||||
cmd++;
|
||||
if (fm != NULL && fm->fnum != curbuf->handle) {
|
||||
(void)mark_move_to(fm, 0);
|
||||
mark_move_to(fm, 0);
|
||||
// Jumped to another file.
|
||||
lnum = curwin->w_cursor.lnum;
|
||||
} else {
|
||||
@@ -3553,7 +3553,7 @@ static linenr_T get_address(exarg_T *eap, char **ptr, cmd_addr_T addr_type, int
|
||||
// closed fold after the first address.
|
||||
if (addr_type == ADDR_LINES && (i == '-' || i == '+')
|
||||
&& address_count >= 2) {
|
||||
(void)hasFolding(lnum, NULL, &lnum);
|
||||
hasFolding(lnum, NULL, &lnum);
|
||||
}
|
||||
if (i == '-') {
|
||||
lnum -= n;
|
||||
@@ -3780,12 +3780,12 @@ int expand_filename(exarg_T *eap, char **cmdlinep, const char **errormsgp)
|
||||
// Decide to expand wildcards *before* replacing '%', '#', etc. If
|
||||
// the file name contains a wildcard it should not cause expanding.
|
||||
// (it will be expanded anyway if there is a wildcard before replacing).
|
||||
int has_wildcards = path_has_wildcard(p);
|
||||
bool has_wildcards = path_has_wildcard(p);
|
||||
while (*p != NUL) {
|
||||
// Skip over `=expr`, wildcards in it are not expanded.
|
||||
if (p[0] == '`' && p[1] == '=') {
|
||||
p += 2;
|
||||
(void)skip_expr(&p, NULL);
|
||||
skip_expr(&p, NULL);
|
||||
if (*p == '`') {
|
||||
p++;
|
||||
}
|
||||
@@ -3860,9 +3860,7 @@ int expand_filename(exarg_T *eap, char **cmdlinep, const char **errormsgp)
|
||||
|| eap->cmdidx == CMD_bang
|
||||
|| eap->cmdidx == CMD_terminal)
|
||||
&& strpbrk(repl, "!") != NULL) {
|
||||
char *l;
|
||||
|
||||
l = vim_strsave_escaped(repl, "!");
|
||||
char *l = vim_strsave_escaped(repl, "!");
|
||||
xfree(repl);
|
||||
repl = l;
|
||||
}
|
||||
@@ -3890,7 +3888,7 @@ int expand_filename(exarg_T *eap, char **cmdlinep, const char **errormsgp)
|
||||
p = NULL;
|
||||
}
|
||||
if (p != NULL) {
|
||||
(void)repl_cmdline(eap, eap->arg, strlen(eap->arg), p, cmdlinep);
|
||||
repl_cmdline(eap, eap->arg, strlen(eap->arg), p, cmdlinep);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3918,7 +3916,7 @@ int expand_filename(exarg_T *eap, char **cmdlinep, const char **errormsgp)
|
||||
if (p == NULL) {
|
||||
return FAIL;
|
||||
}
|
||||
(void)repl_cmdline(eap, eap->arg, strlen(eap->arg), p, cmdlinep);
|
||||
repl_cmdline(eap, eap->arg, strlen(eap->arg), p, cmdlinep);
|
||||
xfree(p);
|
||||
}
|
||||
}
|
||||
@@ -4004,7 +4002,7 @@ void separate_nextcmd(exarg_T *eap)
|
||||
} else if (p[0] == '`' && p[1] == '=' && (eap->argt & EX_XFILE)) {
|
||||
// Skip over `=expr` when wildcards are expanded.
|
||||
p += 2;
|
||||
(void)skip_expr(&p, NULL);
|
||||
skip_expr(&p, NULL);
|
||||
if (*p == NUL) { // stop at NUL after CTRL-V
|
||||
break;
|
||||
}
|
||||
@@ -4063,7 +4061,7 @@ static char *getargcmd(char **argp)
|
||||
/// Find end of "+command" argument. Skip over "\ " and "\\".
|
||||
///
|
||||
/// @param rembs true to halve the number of backslashes
|
||||
char *skip_cmd_arg(char *p, int rembs)
|
||||
char *skip_cmd_arg(char *p, bool rembs)
|
||||
{
|
||||
while (*p && !ascii_isspace(*p)) {
|
||||
if (*p == '\\' && p[1] != NUL) {
|
||||
@@ -4376,7 +4374,7 @@ static void ex_doautocmd(exarg_T *eap)
|
||||
int call_do_modelines = check_nomodeline(&arg);
|
||||
bool did_aucmd;
|
||||
|
||||
(void)do_doautocmd(arg, false, &did_aucmd);
|
||||
do_doautocmd(arg, false, &did_aucmd);
|
||||
// Only when there is no <nomodeline>.
|
||||
if (call_do_modelines && did_aucmd) {
|
||||
do_modelines(0);
|
||||
@@ -4508,7 +4506,7 @@ char *check_nextcmd(char *p)
|
||||
/// @param message when false check only, no messages
|
||||
///
|
||||
/// @return FAIL and give error message if 'message' true, return OK otherwise
|
||||
static int check_more(int message, bool forceit)
|
||||
static int check_more(bool message, bool forceit)
|
||||
{
|
||||
int n = ARGCOUNT - curwin->w_arg_idx - 1;
|
||||
|
||||
@@ -5371,9 +5369,9 @@ void do_exedit(exarg_T *eap, win_T *old_curwin)
|
||||
|| eap->cmdidx == CMD_vnew) && *eap->arg == NUL) {
|
||||
// ":new" or ":tabnew" without argument: edit a new empty buffer
|
||||
setpcmark();
|
||||
(void)do_ecmd(0, NULL, NULL, eap, ECMD_ONE,
|
||||
ECMD_HIDE + (eap->forceit ? ECMD_FORCEIT : 0),
|
||||
old_curwin == NULL ? curwin : NULL);
|
||||
do_ecmd(0, NULL, NULL, eap, ECMD_ONE,
|
||||
ECMD_HIDE + (eap->forceit ? ECMD_FORCEIT : 0),
|
||||
old_curwin == NULL ? curwin : NULL);
|
||||
} else if ((eap->cmdidx != CMD_split && eap->cmdidx != CMD_vsplit)
|
||||
|| *eap->arg != NUL) {
|
||||
// Can't edit another file when "textlock" or "curbuf->b_ro_locked" is set.
|
||||
@@ -5555,7 +5553,7 @@ static void ex_read(exarg_T *eap)
|
||||
eap->line2, 0, (linenr_T)MAXLNUM, eap, 0, false);
|
||||
} else {
|
||||
if (vim_strchr(p_cpo, CPO_ALTREAD) != NULL) {
|
||||
(void)setaltfname(eap->arg, eap->arg, 1);
|
||||
setaltfname(eap->arg, eap->arg, 1);
|
||||
}
|
||||
i = readfile(eap->arg, NULL,
|
||||
eap->line2, 0, (linenr_T)MAXLNUM, eap, 0, false);
|
||||
@@ -5826,7 +5824,7 @@ void do_sleep(int64_t msec)
|
||||
// If CTRL-C was typed to interrupt the sleep, drop the CTRL-C from the
|
||||
// input buffer, otherwise a following call to input() fails.
|
||||
if (got_int) {
|
||||
(void)vpeekc();
|
||||
vpeekc();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5911,7 +5909,7 @@ static void ex_operators(exarg_T *eap)
|
||||
|
||||
case CMD_yank:
|
||||
oa.op_type = OP_YANK;
|
||||
(void)op_yank(&oa, true);
|
||||
op_yank(&oa, true);
|
||||
break;
|
||||
|
||||
default: // CMD_rshift or CMD_lshift
|
||||
@@ -6053,7 +6051,7 @@ static void ex_at(exarg_T *eap)
|
||||
// Continue until the stuff buffer is empty and all added characters
|
||||
// have been consumed.
|
||||
while (!stuff_empty() || typebuf.tb_len > prev_len) {
|
||||
(void)do_cmdline(NULL, getexline, NULL, DOCMD_NOWAIT|DOCMD_VERBOSE);
|
||||
do_cmdline(NULL, getexline, NULL, DOCMD_NOWAIT|DOCMD_VERBOSE);
|
||||
}
|
||||
|
||||
exec_from_reg = save_efr;
|
||||
@@ -6227,7 +6225,7 @@ static void ex_redir(exarg_T *eap)
|
||||
}
|
||||
|
||||
if (var_redir_start(skipwhite(arg), append) == OK) {
|
||||
redir_vname = 1;
|
||||
redir_vname = true;
|
||||
}
|
||||
} else { // TODO(vim): redirect to a buffer
|
||||
semsg(_(e_invarg2), eap->arg);
|
||||
@@ -6333,7 +6331,7 @@ static void close_redir(void)
|
||||
redir_reg = 0;
|
||||
if (redir_vname) {
|
||||
var_redir_stop();
|
||||
redir_vname = 0;
|
||||
redir_vname = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7174,7 +7172,7 @@ static void ex_shada(exarg_T *eap)
|
||||
p_shada = "'100";
|
||||
}
|
||||
if (eap->cmdidx == CMD_rviminfo || eap->cmdidx == CMD_rshada) {
|
||||
(void)shada_read_everything(eap->arg, eap->forceit, false);
|
||||
shada_read_everything(eap->arg, eap->forceit, false);
|
||||
} else {
|
||||
shada_write_file(eap->arg, eap->forceit);
|
||||
}
|
||||
@@ -7245,7 +7243,7 @@ static void ex_filetype(exarg_T *eap)
|
||||
}
|
||||
}
|
||||
if (*arg == 'd') {
|
||||
(void)do_doautocmd("filetypedetect BufRead", true, NULL);
|
||||
do_doautocmd("filetypedetect BufRead", true, NULL);
|
||||
do_modelines(0);
|
||||
}
|
||||
} else if (strcmp(arg, "off") == 0) {
|
||||
|
Reference in New Issue
Block a user