diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2021-12-24 20:47:38 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-12-24 20:47:38 +0000 |
commit | e7f4abd38b6e05100c699900c8f87281e363beb2 (patch) | |
tree | badec536bcfe024c7214b18fcce1fa58e5315f80 /src/evalfunc.c | |
parent | 73a024209cbfbd5b39a2e974084d807c6131e2ed (diff) |
patch 8.2.3889: duplicate code for translating script-local function namev8.2.3889
Problem: Duplicate code for translating script-local function name.
Solution: Move the code to get_scriptlocal_funcname(). (Yegappan Lakshmanan,
closes #9393)
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r-- | src/evalfunc.c | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c index 778d16d77b..8f52053938 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -4050,22 +4050,11 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref) list_T *list = NULL; if (STRNCMP(s, "s:", 2) == 0 || STRNCMP(s, "<SID>", 5) == 0) - { - char sid_buf[25]; - int off = *s == 's' ? 2 : 5; - // Expand s: and <SID> into <SNR>nr_, so that the function can // also be called from another script. Using trans_function_name() // would also work, but some plugins depend on the name being // printable text. - sprintf(sid_buf, "<SNR>%ld_", (long)current_sctx.sc_sid); - name = alloc(STRLEN(sid_buf) + STRLEN(s + off) + 1); - if (name != NULL) - { - STRCPY(name, sid_buf); - STRCAT(name, s + off); - } - } + name = get_scriptlocal_funcname(s); else name = vim_strsave(s); |