refactor: fix incorrect use of enum (#30631)

This commit is contained in:
zeertzjq 2024-10-03 10:34:55 +08:00 committed by GitHub
parent aeea63081c
commit 184d5e7543
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 6 deletions

View File

@ -1160,7 +1160,7 @@ static void do_filter(linenr_T line1, linenr_T line2, exarg_T *eap, char *cmd, b
linenr_T read_linecount = curbuf->b_ml.ml_line_count;
// Pass on the kShellOptDoOut flag when the output is being redirected.
call_shell(cmd_buf, (ShellOpts)(kShellOptFilter | shell_flags), NULL);
call_shell(cmd_buf, kShellOptFilter | shell_flags, NULL);
xfree(cmd_buf);
did_check_timestamps = false;
@ -1305,7 +1305,7 @@ void do_shell(char *cmd, int flags)
// This ui_cursor_goto is required for when the '\n' resulted in a "delete line
// 1" command to the terminal.
ui_cursor_goto(msg_row, msg_col);
call_shell(cmd, (ShellOpts)flags, NULL);
call_shell(cmd, flags, NULL);
if (msg_silent == 0) {
msg_didout = true;
}

View File

@ -115,7 +115,7 @@ int os_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, in
size_t len;
char *p;
char *extra_shell_arg = NULL;
ShellOpts shellopts = kShellOptExpand | kShellOptSilent;
int shellopts = kShellOptExpand | kShellOptSilent;
int j;
char *tempname;
#define STYLE_ECHO 0 // use "echo", the default
@ -659,7 +659,7 @@ char *shell_argv_to_str(char **const argv)
/// @param extra_args Extra arguments to the shell, or NULL.
///
/// @return shell command exit code
int os_call_shell(char *cmd, ShellOpts opts, char *extra_args)
int os_call_shell(char *cmd, int opts, char *extra_args)
{
StringBuilder input = KV_INITIAL_VALUE;
char *output = NULL;
@ -714,8 +714,10 @@ int os_call_shell(char *cmd, ShellOpts opts, char *extra_args)
/// os_call_shell() wrapper. Handles 'verbose', :profile, and v:shell_error.
/// Invalidates cached tags.
///
/// @param opts a combination of ShellOpts flags
///
/// @return shell command exit code
int call_shell(char *cmd, ShellOpts opts, char *extra_shell_arg)
int call_shell(char *cmd, int opts, char *extra_shell_arg)
{
int retval;
proftime_T wait_time;
@ -759,7 +761,7 @@ int call_shell(char *cmd, ShellOpts opts, char *extra_shell_arg)
/// @param ret_len length of the stdout
///
/// @return an allocated string, or NULL for error.
char *get_cmd_output(char *cmd, char *infile, ShellOpts flags, size_t *ret_len)
char *get_cmd_output(char *cmd, char *infile, int flags, size_t *ret_len)
{
char *buffer = NULL;