diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2016-07-31 13:23:29 -0400 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-07-31 13:23:29 -0400 | 
| commit | aa2c43994039b4d78ae628f96b80bf1a60b4da6b (patch) | |
| tree | 3ccecd954ee0b62b291f5e105b3dd40370c2cde8 /src/nvim/eval.c | |
| parent | faca814116282b589319fca738a971ce2a8fef7e (diff) | |
| download | rneovim-aa2c43994039b4d78ae628f96b80bf1a60b4da6b.tar.gz rneovim-aa2c43994039b4d78ae628f96b80bf1a60b4da6b.tar.bz2 rneovim-aa2c43994039b4d78ae628f96b80bf1a60b4da6b.zip | |
eval.c: rename capture() to execute() (#5132)
Diffstat (limited to 'src/nvim/eval.c')
| -rw-r--r-- | src/nvim/eval.c | 66 | 
1 files changed, 33 insertions, 33 deletions
| diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 7fb7969783..824b298592 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -6727,7 +6727,6 @@ static struct fst {    { "byteidx",           2, 2, f_byteidx },    { "byteidxcomp",       2, 2, f_byteidxcomp },    { "call",              2, 3, f_call }, -  { "capture",           1, 1, f_capture },    { "ceil",              1, 1, f_ceil },    { "changenr",          0, 0, f_changenr },    { "char2nr",           1, 2, f_char2nr }, @@ -6756,6 +6755,7 @@ static struct fst {    { "eval",              1, 1, f_eval },    { "eventhandler",      0, 0, f_eventhandler },    { "executable",        1, 1, f_executable }, +  { "execute",           1, 1, f_execute },    { "exepath",           1, 1, f_exepath },    { "exists",            1, 1, f_exists },    { "exp",               1, 1, f_exp }, @@ -8153,38 +8153,6 @@ static void f_call(typval_T *argvars, typval_T *rettv)    (void)func_call(func, &argvars[1], selfdict, rettv);  } -// "capture(command)" function -static void f_capture(typval_T *argvars, typval_T *rettv) -{ -    int save_msg_silent = msg_silent; -    garray_T *save_capture_ga = capture_ga; - -    if (check_secure()) { -      return; -    } - -    garray_T capture_local; -    capture_ga = &capture_local; -    ga_init(capture_ga, (int)sizeof(char), 80); - -    msg_silent++; -    if (argvars[0].v_type != VAR_LIST) { -      do_cmdline_cmd((char *)get_tv_string(&argvars[0])); -    } else if (argvars[0].vval.v_list != NULL) { -      for (listitem_T *li = argvars[0].vval.v_list->lv_first; -           li != NULL; li = li->li_next) { -        do_cmdline_cmd((char *)get_tv_string(&li->li_tv)); -      } -    } -    msg_silent = save_msg_silent; - -    ga_append(capture_ga, NUL); -    rettv->v_type = VAR_STRING; -    rettv->vval.v_string = capture_ga->ga_data; - -    capture_ga = save_capture_ga; -} -  /*   * "ceil({float})" function   */ @@ -8869,6 +8837,38 @@ static void f_executable(typval_T *argvars, typval_T *rettv)             || (gettail_dir(name) != name && os_can_exe(name, NULL, false));  } +// "execute(command)" function +static void f_execute(typval_T *argvars, typval_T *rettv) +{ +    int save_msg_silent = msg_silent; +    garray_T *save_capture_ga = capture_ga; + +    if (check_secure()) { +      return; +    } + +    garray_T capture_local; +    capture_ga = &capture_local; +    ga_init(capture_ga, (int)sizeof(char), 80); + +    msg_silent++; +    if (argvars[0].v_type != VAR_LIST) { +      do_cmdline_cmd((char *)get_tv_string(&argvars[0])); +    } else if (argvars[0].vval.v_list != NULL) { +      for (listitem_T *li = argvars[0].vval.v_list->lv_first; +           li != NULL; li = li->li_next) { +        do_cmdline_cmd((char *)get_tv_string(&li->li_tv)); +      } +    } +    msg_silent = save_msg_silent; + +    ga_append(capture_ga, NUL); +    rettv->v_type = VAR_STRING; +    rettv->vval.v_string = capture_ga->ga_data; + +    capture_ga = save_capture_ga; +} +  /// "exepath()" function  static void f_exepath(typval_T *argvars, typval_T *rettv)  { | 
