diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-06-29 20:20:33 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-06-29 20:20:33 +0200 |
commit | 7d2ac92ebc36049f9ce2f4ce08b8a80ca212ace2 (patch) | |
tree | f8c943ac9a17ca278780ea1c8631f92518195781 /src/userfunc.c | |
parent | fda20c4cc59008264676a6deb6a3095ed0c248e0 (diff) | |
download | vim-git-7d2ac92ebc36049f9ce2f4ce08b8a80ca212ace2.tar.gz |
patch 8.2.1084: Lua: registering function has useless codev8.2.1084
Problem: Lua: registering function has useless code.
Solution: Remove clearing grow arrays.
Diffstat (limited to 'src/userfunc.c')
-rw-r--r-- | src/userfunc.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/src/userfunc.c b/src/userfunc.c index 05d3fda34..724d1247d 100644 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -350,16 +350,11 @@ get_lambda_name(void) register_cfunc(cfunc_T cb, cfunc_free_T cb_free, void *state) { char_u *name = get_lambda_name(); - ufunc_T *fp = NULL; - garray_T newargs; - garray_T newlines; - - ga_init(&newargs); - ga_init(&newlines); + ufunc_T *fp; fp = alloc_clear(offsetof(ufunc_T, uf_name) + STRLEN(name) + 1); if (fp == NULL) - goto errret; + return NULL; fp->uf_dfunc_idx = UF_NOT_COMPILED; fp->uf_refcount = 1; @@ -367,8 +362,6 @@ register_cfunc(cfunc_T cb, cfunc_free_T cb_free, void *state) fp->uf_flags = FC_CFUNC; fp->uf_calls = 0; fp->uf_script_ctx = current_sctx; - fp->uf_lines = newlines; - fp->uf_args = newargs; fp->uf_cb = cb; fp->uf_cb_free = cb_free; fp->uf_cb_state = state; @@ -377,12 +370,6 @@ register_cfunc(cfunc_T cb, cfunc_free_T cb_free, void *state) hash_add(&func_hashtab, UF2HIKEY(fp)); return name; - -errret: - ga_clear_strings(&newargs); - ga_clear_strings(&newlines); - vim_free(fp); - return NULL; } #endif |