comparison src/userfunc.c @ 20007:aadd1cae2ff5 v8.2.0559

patch 8.2.0559: clearing a struct is verbose Commit: https://github.com/vim/vim/commit/a80faa8930ed5a554beeb2727762538873135e83 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Apr 12 19:37:17 2020 +0200 patch 8.2.0559: clearing a struct is verbose Problem: Clearing a struct is verbose. Solution: Define and use CLEAR_FIELD() and CLEAR_POINTER().
author Bram Moolenaar <Bram@vim.org>
date Sun, 12 Apr 2020 19:45:05 +0200
parents 8466e62a2481
children c001ee73519a
comparison
equal deleted inserted replaced
20006:aee3c9266968 20007:aadd1cae2ff5
1134 hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v)); 1134 hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v));
1135 v->di_tv.v_type = VAR_LIST; 1135 v->di_tv.v_type = VAR_LIST;
1136 v->di_tv.v_lock = VAR_FIXED; 1136 v->di_tv.v_lock = VAR_FIXED;
1137 v->di_tv.vval.v_list = &fc->l_varlist; 1137 v->di_tv.vval.v_list = &fc->l_varlist;
1138 } 1138 }
1139 vim_memset(&fc->l_varlist, 0, sizeof(list_T)); 1139 CLEAR_FIELD(fc->l_varlist);
1140 fc->l_varlist.lv_refcount = DO_NOT_FREE_CNT; 1140 fc->l_varlist.lv_refcount = DO_NOT_FREE_CNT;
1141 fc->l_varlist.lv_lock = VAR_FIXED; 1141 fc->l_varlist.lv_lock = VAR_FIXED;
1142 1142
1143 /* 1143 /*
1144 * Set a:firstline to "firstline" and a:lastline to "lastline". 1144 * Set a:firstline to "firstline" and a:lastline to "lastline".
1657 1657
1658 if (item == NULL) 1658 if (item == NULL)
1659 { 1659 {
1660 funcexe_T funcexe; 1660 funcexe_T funcexe;
1661 1661
1662 vim_memset(&funcexe, 0, sizeof(funcexe)); 1662 CLEAR_FIELD(funcexe);
1663 funcexe.firstline = curwin->w_cursor.lnum; 1663 funcexe.firstline = curwin->w_cursor.lnum;
1664 funcexe.lastline = curwin->w_cursor.lnum; 1664 funcexe.lastline = curwin->w_cursor.lnum;
1665 funcexe.evaluate = TRUE; 1665 funcexe.evaluate = TRUE;
1666 funcexe.partial = partial; 1666 funcexe.partial = partial;
1667 funcexe.selfdict = selfdict; 1667 funcexe.selfdict = selfdict;
1696 // PLUS ONE elements! 1696 // PLUS ONE elements!
1697 { 1697 {
1698 funcexe_T funcexe; 1698 funcexe_T funcexe;
1699 int ret; 1699 int ret;
1700 1700
1701 vim_memset(&funcexe, 0, sizeof(funcexe)); 1701 CLEAR_FIELD(funcexe);
1702 funcexe.evaluate = TRUE; 1702 funcexe.evaluate = TRUE;
1703 funcexe.partial = callback->cb_partial; 1703 funcexe.partial = callback->cb_partial;
1704 ++callback_depth; 1704 ++callback_depth;
1705 ret = call_func(callback->cb_name, len, rettv, argcount, argvars, &funcexe); 1705 ret = call_func(callback->cb_name, len, rettv, argcount, argvars, &funcexe);
1706 --callback_depth; 1706 --callback_depth;
2050 int extra = 0; 2050 int extra = 0;
2051 lval_T lv; 2051 lval_T lv;
2052 int vim9script; 2052 int vim9script;
2053 2053
2054 if (fdp != NULL) 2054 if (fdp != NULL)
2055 vim_memset(fdp, 0, sizeof(funcdict_T)); 2055 CLEAR_POINTER(fdp);
2056 start = *pp; 2056 start = *pp;
2057 2057
2058 // Check for hard coded <SNR>: already translated function ID (from a user 2058 // Check for hard coded <SNR>: already translated function ID (from a user
2059 // command). 2059 // command).
2060 if ((*pp)[0] == K_SPECIAL && (*pp)[1] == KS_EXTRA 2060 if ((*pp)[0] == K_SPECIAL && (*pp)[1] == KS_EXTRA
3570 curwin->w_cursor.col = 0; 3570 curwin->w_cursor.col = 0;
3571 curwin->w_cursor.coladd = 0; 3571 curwin->w_cursor.coladd = 0;
3572 } 3572 }
3573 arg = startarg; 3573 arg = startarg;
3574 3574
3575 vim_memset(&funcexe, 0, sizeof(funcexe)); 3575 CLEAR_FIELD(funcexe);
3576 funcexe.firstline = eap->line1; 3576 funcexe.firstline = eap->line1;
3577 funcexe.lastline = eap->line2; 3577 funcexe.lastline = eap->line2;
3578 funcexe.doesrange = &doesrange; 3578 funcexe.doesrange = &doesrange;
3579 funcexe.evaluate = !eap->skip; 3579 funcexe.evaluate = !eap->skip;
3580 funcexe.partial = partial; 3580 funcexe.partial = partial;