Patch 8.2.1084

4 views
Skip to first unread message

Bram Moolenaar

unread,
Jun 29, 2020, 2:21:05 PM6/29/20
to vim...@googlegroups.com

Patch 8.2.1084
Problem: Lua: registering function has useless code.
Solution: Remove clearing grow arrays.
Files: src/userfunc.c


*** ../vim-8.2.1083/src/userfunc.c 2020-06-28 18:43:36.296992324 +0200
--- src/userfunc.c 2020-06-29 20:20:12.675975886 +0200
***************
*** 350,365 ****
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);

fp = alloc_clear(offsetof(ufunc_T, uf_name) + STRLEN(name) + 1);
if (fp == NULL)
! goto errret;

fp->uf_dfunc_idx = UF_NOT_COMPILED;
fp->uf_refcount = 1;
--- 350,360 ----
register_cfunc(cfunc_T cb, cfunc_free_T cb_free, void *state)
{
char_u *name = get_lambda_name();
! ufunc_T *fp;

fp = alloc_clear(offsetof(ufunc_T, uf_name) + STRLEN(name) + 1);
if (fp == NULL)
! return NULL;

fp->uf_dfunc_idx = UF_NOT_COMPILED;
fp->uf_refcount = 1;
***************
*** 367,374 ****
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;
--- 362,367 ----
***************
*** 377,388 ****
hash_add(&func_hashtab, UF2HIKEY(fp));

return name;
-
- errret:
- ga_clear_strings(&newargs);
- ga_clear_strings(&newlines);
- vim_free(fp);
- return NULL;
}
#endif

--- 370,375 ----
*** ../vim-8.2.1083/src/version.c 2020-06-29 20:09:33.266762870 +0200
--- src/version.c 2020-06-29 20:19:43.608119318 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 1084,
/**/

--
The chat program is in public domain. This is not the GNU public license.
If it breaks then you get to keep both pieces.
-- Copyright notice for the chat program

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages