diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-04-14 17:41:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-14 17:41:59 +0200 |
commit | 45b5ebea9ddf029b3453ab21d20ae41f32c8de97 (patch) | |
tree | 390962aa4ec763d7980d71b93d540c05be64d942 /src | |
parent | dd391bfca1f37093ba556f5da6a7f3eb81147fc0 (diff) | |
download | rneovim-45b5ebea9ddf029b3453ab21d20ae41f32c8de97.tar.gz rneovim-45b5ebea9ddf029b3453ab21d20ae41f32c8de97.tar.bz2 rneovim-45b5ebea9ddf029b3453ab21d20ae41f32c8de97.zip |
perf: tv_clear(): Cache gettext() result. (#6519)
Closes #6437
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/eval/typval.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index 779bb18175..eb6db9547b 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -1837,9 +1837,12 @@ static inline void _nothing_conv_dict_end(typval_T *const tv, /// @param[in,out] tv Value to free. void tv_clear(typval_T *const tv) { + static char *objname = NULL; // cached because gettext() is slow. #6437 + if (objname == NULL) { + objname = xstrdup(_("tv_clear() argument")); + } if (tv != NULL && tv->v_type != VAR_UNKNOWN) { - const int evn_ret = encode_vim_to_nothing(NULL, tv, - _("tv_clear() argument")); + const int evn_ret = encode_vim_to_nothing(NULL, tv, objname); (void)evn_ret; assert(evn_ret == OK); } |