diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-04-12 19:37:17 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-04-12 19:37:17 +0200 |
commit | a80faa8930ed5a554beeb2727762538873135e83 (patch) | |
tree | e797605e0c781214543fcba103cffede7af611cd /src/eval.c | |
parent | 82de464f763d6e6d89229be03ce7c6d02fd5fb59 (diff) |
patch 8.2.0559: clearing a struct is verbosev8.2.0559
Problem: Clearing a struct is verbose.
Solution: Define and use CLEAR_FIELD() and CLEAR_POINTER().
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/eval.c b/src/eval.c index 3b789dadc6..fbbae637a9 100644 --- a/src/eval.c +++ b/src/eval.c @@ -234,7 +234,7 @@ eval_expr_typval(typval_T *expr, typval_T *argv, int argc, typval_T *rettv) s = expr->vval.v_string; if (s == NULL || *s == NUL) return FAIL; - vim_memset(&funcexe, 0, sizeof(funcexe)); + CLEAR_FIELD(funcexe); funcexe.evaluate = TRUE; if (call_func(s, -1, rettv, argc, argv, &funcexe) == FAIL) return FAIL; @@ -253,7 +253,7 @@ eval_expr_typval(typval_T *expr, typval_T *argv, int argc, typval_T *rettv) s = partial_name(partial); if (s == NULL || *s == NUL) return FAIL; - vim_memset(&funcexe, 0, sizeof(funcexe)); + CLEAR_FIELD(funcexe); funcexe.evaluate = TRUE; funcexe.partial = partial; if (call_func(s, -1, rettv, argc, argv, &funcexe) == FAIL) @@ -475,7 +475,7 @@ call_vim_function( funcexe_T funcexe; rettv->v_type = VAR_UNKNOWN; // clear_tv() uses this - vim_memset(&funcexe, 0, sizeof(funcexe)); + CLEAR_FIELD(funcexe); funcexe.firstline = curwin->w_cursor.lnum; funcexe.lastline = curwin->w_cursor.lnum; funcexe.evaluate = TRUE; @@ -649,7 +649,7 @@ get_lval( int quiet = flags & GLV_QUIET; // Clear everything in "lp". - vim_memset(lp, 0, sizeof(lval_T)); + CLEAR_POINTER(lp); if (skip) { @@ -1715,7 +1715,7 @@ eval_func( funcexe_T funcexe; // Invoke the function. - vim_memset(&funcexe, 0, sizeof(funcexe)); + CLEAR_FIELD(funcexe); funcexe.firstline = curwin->w_cursor.lnum; funcexe.lastline = curwin->w_cursor.lnum; funcexe.evaluate = evaluate; @@ -2805,7 +2805,7 @@ call_func_rettv( else s = (char_u *)""; - vim_memset(&funcexe, 0, sizeof(funcexe)); + CLEAR_FIELD(funcexe); funcexe.firstline = curwin->w_cursor.lnum; funcexe.lastline = curwin->w_cursor.lnum; funcexe.evaluate = evaluate; @@ -5507,7 +5507,7 @@ clear_tv(typval_T *varp) init_tv(typval_T *varp) { if (varp != NULL) - vim_memset(varp, 0, sizeof(typval_T)); + CLEAR_POINTER(varp); } /* |