diff options
| author | dundargoc <gocdundar@gmail.com> | 2023-12-28 13:42:24 +0100 |
|---|---|---|
| committer | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2023-12-30 12:45:38 +0100 |
| commit | c89292fcb7f2ebf06efb7c1d00c28f34c6f68fec (patch) | |
| tree | b1257a572495337ca936c47839bb08aa45528c84 /src/nvim/os | |
| parent | d634cd5b0bc3ac6bdf285432f74a1c10f12b6031 (diff) | |
| download | rneovim-c89292fcb7f2ebf06efb7c1d00c28f34c6f68fec.tar.gz rneovim-c89292fcb7f2ebf06efb7c1d00c28f34c6f68fec.tar.bz2 rneovim-c89292fcb7f2ebf06efb7c1d00c28f34c6f68fec.zip | |
refactor: follow style guide
Diffstat (limited to 'src/nvim/os')
| -rw-r--r-- | src/nvim/os/env.c | 4 | ||||
| -rw-r--r-- | src/nvim/os/lang.c | 13 | ||||
| -rw-r--r-- | src/nvim/os/shell.c | 16 |
3 files changed, 12 insertions, 21 deletions
diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c index 3c5d6d2159..34b2d89f0b 100644 --- a/src/nvim/os/env.c +++ b/src/nvim/os/env.c @@ -587,7 +587,7 @@ void expand_env_esc(char *restrict srcp, char *restrict dst, int dstlen, bool es if (src[0] == '`' && src[1] == '=') { var = src; src += 2; - (void)skip_expr(&src, NULL); + skip_expr(&src, NULL); if (*src == '`') { src++; } @@ -1061,7 +1061,7 @@ size_t home_replace(const buf_T *const buf, const char *src, char *const dst, si size_t usedlen = 0; size_t flen = strlen(homedir_env_mod); char *fbuf = NULL; - (void)modify_fname(":p", false, &usedlen, &homedir_env_mod, &fbuf, &flen); + modify_fname(":p", false, &usedlen, &homedir_env_mod, &fbuf, &flen); flen = strlen(homedir_env_mod); assert(homedir_env_mod != homedir_env); if (vim_ispathsep(homedir_env_mod[flen - 1])) { diff --git a/src/nvim/os/lang.c b/src/nvim/os/lang.c index 20b60150ee..617ce4d3ea 100644 --- a/src/nvim/os/lang.c +++ b/src/nvim/os/lang.c @@ -100,9 +100,7 @@ static char *get_mess_env(void) /// Also do "v:lc_time"and "v:ctype". void set_lang_var(void) { - const char *loc; - - loc = get_locale_val(LC_CTYPE); + const char *loc = get_locale_val(LC_CTYPE); set_vim_var_string(VV_CTYPE, loc, -1); loc = get_mess_env(); @@ -143,8 +141,6 @@ void init_locale(void) void ex_language(exarg_T *eap) { char *loc; - char *p; - char *name; int what = LC_ALL; char *whatstr = ""; #ifdef LC_MESSAGES @@ -153,12 +149,12 @@ void ex_language(exarg_T *eap) # define VIM_LC_MESSAGES 6789 #endif - name = eap->arg; + char *name = eap->arg; // Check for "messages {name}", "ctype {name}" or "time {name}" argument. // Allow abbreviation, but require at least 3 characters to avoid // confusion with a two letter language name "me" or "ct". - p = skiptowhite(eap->arg); + char *p = skiptowhite(eap->arg); if ((*p == NUL || ascii_iswhite(*p)) && p - eap->arg >= 3) { if (STRNICMP(eap->arg, "messages", p - eap->arg) == 0) { what = VIM_LC_MESSAGES; @@ -249,7 +245,6 @@ static bool did_init_locales = false; static char **find_locales(void) { garray_T locales_ga; - char *loc; char *saveptr = NULL; // Find all available locales by running command "locale -a". If this @@ -262,7 +257,7 @@ static char **find_locales(void) // Transform locale_a string where each locale is separated by "\n" // into an array of locale strings. - loc = os_strtok(locale_a, "\n", &saveptr); + char *loc = os_strtok(locale_a, "\n", &saveptr); while (loc != NULL) { loc = xstrdup(loc); diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c index aa5075a79b..8f541a829d 100644 --- a/src/nvim/os/shell.c +++ b/src/nvim/os/shell.c @@ -119,14 +119,10 @@ int os_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, in int i; size_t len; char *p; - bool dir; char *extra_shell_arg = NULL; ShellOpts shellopts = kShellOptExpand | kShellOptSilent; int j; char *tempname; - char *command; - FILE *fd; - char *buffer; #define STYLE_ECHO 0 // use "echo", the default #define STYLE_GLOB 1 // use "glob", for csh #define STYLE_VIMGLOB 2 // use "vimglob", for Posix sh @@ -242,7 +238,7 @@ int os_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, in len += sizeof("egin;" " end") - 1; } - command = xmalloc(len); + char *command = xmalloc(len); // Build the shell command: // - Set $nonomatch depending on EW_NOTFOUND (hopefully the shell @@ -390,7 +386,7 @@ int os_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, in } // read the names from the file into memory - fd = fopen(tempname, READBIN); + FILE *fd = fopen(tempname, READBIN); if (fd == NULL) { // Something went wrong, perhaps a file name with a special char. if (!(flags & EW_SILENT)) { @@ -417,7 +413,7 @@ int os_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, in #endif len = (size_t)templen; fseek(fd, 0, SEEK_SET); - buffer = xmalloc(len + 1); + char *buffer = xmalloc(len + 1); // fread() doesn't terminate buffer with NUL; // appropriate termination (not always NUL) is done below. size_t readlen = fread(buffer, 1, len, fd); @@ -538,7 +534,7 @@ int os_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, in } // check if this entry should be included - dir = (os_isdir((*file)[i])); + bool dir = (os_isdir((*file)[i])); if ((dir && !(flags & EW_DIR)) || (!dir && !(flags & EW_FILE))) { continue; } @@ -704,7 +700,7 @@ int os_call_shell(char *cmd, ShellOpts opts, char *extra_args) xfree(input.data); if (output) { - (void)write_output(output, nread, true); + write_output(output, nread, true); xfree(output); } @@ -1144,7 +1140,7 @@ static void out_data_append_to_screen(char *output, size_t *count, bool eof) goto end; } - (void)msg_outtrans_len(p, i, 0); + msg_outtrans_len(p, i, 0); p += i; } } |