refactor: follow style guide

- reduce variable scope
- prefer initialization over declaration and assignment
- use bool to represent boolean values
This commit is contained in:
dundargoc
2023-11-12 15:54:54 +01:00
committed by dundargoc
parent 48bcc7b971
commit 28f4f3c484
42 changed files with 287 additions and 554 deletions

View File

@@ -1749,7 +1749,6 @@ static void create_windows(mparm_T *parmp)
static void edit_buffers(mparm_T *parmp, char *cwd)
{
int arg_idx; // index in argument list
int i;
bool advance = true;
win_T *win;
char *p_shm_save = NULL;
@@ -1765,7 +1764,7 @@ static void edit_buffers(mparm_T *parmp, char *cwd)
}
arg_idx = 1;
for (i = 1; i < parmp->window_count; i++) {
for (int i = 1; i < parmp->window_count; i++) {
if (cwd != NULL) {
os_chdir(cwd);
}
@@ -1869,7 +1868,6 @@ static void exe_pre_commands(mparm_T *parmp)
{
char **cmds = parmp->pre_commands;
int cnt = parmp->n_pre_commands;
int i;
if (cnt <= 0) {
return;
@@ -1878,7 +1876,7 @@ static void exe_pre_commands(mparm_T *parmp)
curwin->w_cursor.lnum = 0; // just in case..
estack_push(ETYPE_ARGS, _("pre-vimrc command line"), 0);
current_sctx.sc_sid = SID_CMDARG;
for (i = 0; i < cnt; i++) {
for (int i = 0; i < cnt; i++) {
do_cmdline_cmd(cmds[i]);
}
estack_pop();
@@ -1889,8 +1887,6 @@ static void exe_pre_commands(mparm_T *parmp)
// Execute "+", "-c" and "-S" arguments.
static void exe_commands(mparm_T *parmp)
{
int i;
// We start commands on line 0, make "vim +/pat file" match a
// pattern on line 1. But don't move the cursor when an autocommand
// with g`" was used.
@@ -1901,7 +1897,7 @@ static void exe_commands(mparm_T *parmp)
estack_push(ETYPE_ARGS, "command line", 0);
current_sctx.sc_sid = SID_CARG;
current_sctx.sc_seq = 0;
for (i = 0; i < parmp->n_commands; i++) {
for (int i = 0; i < parmp->n_commands; i++) {
do_cmdline_cmd(parmp->commands[i]);
if (parmp->cmds_tofree[i]) {
xfree(parmp->commands[i]);