Mercurial > vim
comparison src/vim9execute.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 | 014daa59ba50 |
children | ee823254dda5 |
comparison
equal
deleted
inserted
replaced
20006:aee3c9266968 | 20007:aadd1cae2ff5 |
---|---|
356 return call_dfunc(ufunc->uf_dfunc_idx, argcount, ectx); | 356 return call_dfunc(ufunc->uf_dfunc_idx, argcount, ectx); |
357 } | 357 } |
358 | 358 |
359 if (call_prepare(argcount, argvars, ectx) == FAIL) | 359 if (call_prepare(argcount, argvars, ectx) == FAIL) |
360 return FAIL; | 360 return FAIL; |
361 vim_memset(&funcexe, 0, sizeof(funcexe)); | 361 CLEAR_FIELD(funcexe); |
362 funcexe.evaluate = TRUE; | 362 funcexe.evaluate = TRUE; |
363 | 363 |
364 // Call the user function. Result goes in last position on the stack. | 364 // Call the user function. Result goes in last position on the stack. |
365 // TODO: add selfdict if there is one | 365 // TODO: add selfdict if there is one |
366 error = call_user_func_check(ufunc, argcount, argvars, | 366 error = call_user_func_check(ufunc, argcount, argvars, |
496 #define STACK_TV_BOT(idx) (((typval_T *)ectx.ec_stack.ga_data) + ectx.ec_stack.ga_len + idx) | 496 #define STACK_TV_BOT(idx) (((typval_T *)ectx.ec_stack.ga_data) + ectx.ec_stack.ga_len + idx) |
497 | 497 |
498 // Get pointer to a local variable on the stack. Negative for arguments. | 498 // Get pointer to a local variable on the stack. Negative for arguments. |
499 #define STACK_TV_VAR(idx) (((typval_T *)ectx.ec_stack.ga_data) + ectx.ec_frame + STACK_FRAME_SIZE + idx) | 499 #define STACK_TV_VAR(idx) (((typval_T *)ectx.ec_stack.ga_data) + ectx.ec_frame + STACK_FRAME_SIZE + idx) |
500 | 500 |
501 vim_memset(&ectx, 0, sizeof(ectx)); | 501 CLEAR_FIELD(ectx); |
502 ga_init2(&ectx.ec_stack, sizeof(typval_T), 500); | 502 ga_init2(&ectx.ec_stack, sizeof(typval_T), 500); |
503 if (ga_grow(&ectx.ec_stack, 20) == FAIL) | 503 if (ga_grow(&ectx.ec_stack, 20) == FAIL) |
504 return FAIL; | 504 return FAIL; |
505 ectx.ec_dfunc_idx = ufunc->uf_dfunc_idx; | 505 ectx.ec_dfunc_idx = ufunc->uf_dfunc_idx; |
506 | 506 |