1
0
forked from aniani/vim

patch 8.2.1084: Lua: registering function has useless code

Problem:    Lua: registering function has useless code.
Solution:   Remove clearing grow arrays.
This commit is contained in:
Bram Moolenaar
2020-06-29 20:20:33 +02:00
parent fda20c4cc5
commit 7d2ac92ebc
2 changed files with 4 additions and 15 deletions

View File

@@ -350,16 +350,11 @@ get_lambda_name(void)
register_cfunc(cfunc_T cb, cfunc_free_T cb_free, void *state) register_cfunc(cfunc_T cb, cfunc_free_T cb_free, void *state)
{ {
char_u *name = get_lambda_name(); char_u *name = get_lambda_name();
ufunc_T *fp = NULL; ufunc_T *fp;
garray_T newargs;
garray_T newlines;
ga_init(&newargs);
ga_init(&newlines);
fp = alloc_clear(offsetof(ufunc_T, uf_name) + STRLEN(name) + 1); fp = alloc_clear(offsetof(ufunc_T, uf_name) + STRLEN(name) + 1);
if (fp == NULL) if (fp == NULL)
goto errret; return NULL;
fp->uf_dfunc_idx = UF_NOT_COMPILED; fp->uf_dfunc_idx = UF_NOT_COMPILED;
fp->uf_refcount = 1; 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_flags = FC_CFUNC;
fp->uf_calls = 0; fp->uf_calls = 0;
fp->uf_script_ctx = current_sctx; fp->uf_script_ctx = current_sctx;
fp->uf_lines = newlines;
fp->uf_args = newargs;
fp->uf_cb = cb; fp->uf_cb = cb;
fp->uf_cb_free = cb_free; fp->uf_cb_free = cb_free;
fp->uf_cb_state = state; 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)); hash_add(&func_hashtab, UF2HIKEY(fp));
return name; return name;
errret:
ga_clear_strings(&newargs);
ga_clear_strings(&newlines);
vim_free(fp);
return NULL;
} }
#endif #endif

View File

@@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1084,
/**/ /**/
1083, 1083,
/**/ /**/