]> granicus.if.org Git - vim/commitdiff
patch 8.2.1084: Lua: registering function has useless code v8.2.1084
authorBram Moolenaar <Bram@vim.org>
Mon, 29 Jun 2020 18:20:33 +0000 (20:20 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 29 Jun 2020 18:20:33 +0000 (20:20 +0200)
Problem:    Lua: registering function has useless code.
Solution:   Remove clearing grow arrays.

src/userfunc.c
src/version.c

index 05d3fda34c7f05082d0ff09d70497e797d498041..724d1247d9d2e12992af5e3473fe849fbf6e9e00 100644 (file)
@@ -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
 
index 2ffa1114798f3102638882b88e9b86dc50188394..b3d0a9354e0982f6a7ce55bf41a6f150d9ce980d 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1084,
 /**/
     1083,
 /**/