diff options
Diffstat (limited to 'src/nvim/ex_cmds2.c')
-rw-r--r-- | src/nvim/ex_cmds2.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index a1a32d9f52..1a728647ca 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -3705,19 +3705,18 @@ char_u *get_locales(expand_T *xp, int idx) static void script_host_execute(char *name, exarg_T *eap) { - uint8_t *script = script_get(eap, eap->arg); + size_t len; + char *const script = script_get(eap, &len); - if (!eap->skip) { - list_T *args = tv_list_alloc(); + if (script != NULL) { + list_T *const args = tv_list_alloc(); // script - tv_list_append_string(args, (const char *)(script ? script : eap->arg), -1); + tv_list_append_allocated_string(args, script); // current range tv_list_append_number(args, (int)eap->line1); tv_list_append_number(args, (int)eap->line2); (void)eval_call_provider(name, "execute", args); } - - xfree(script); } static void script_host_execute_file(char *name, exarg_T *eap) |