diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-04-23 01:02:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-23 01:02:39 +0200 |
commit | a9d37c928e109f8bb75faf24c5b4effb90b115ff (patch) | |
tree | 71b81415cfcfcc82deb5d43a7301a7a12a315f52 /src/nvim/eval/typval.h | |
parent | 77b6de0968172fec57412f92c19bb84d76d7dc77 (diff) | |
parent | d463c9e03a79e981faaaa985b1160c292d08e172 (diff) | |
download | rneovim-a9d37c928e109f8bb75faf24c5b4effb90b115ff.tar.gz rneovim-a9d37c928e109f8bb75faf24c5b4effb90b115ff.tar.bz2 rneovim-a9d37c928e109f8bb75faf24c5b4effb90b115ff.zip |
Merge #6513 from ZyX-I/lazier-arg_errmsg-gettext
Diffstat (limited to 'src/nvim/eval/typval.h')
-rw-r--r-- | src/nvim/eval/typval.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/nvim/eval/typval.h b/src/nvim/eval/typval.h index 7eab22bc12..0f659727ee 100644 --- a/src/nvim/eval/typval.h +++ b/src/nvim/eval/typval.h @@ -17,6 +17,7 @@ #include "nvim/pos.h" // for linenr_T #include "nvim/gettext.h" #include "nvim/message.h" +#include "nvim/macros.h" /// Type used for VimL VAR_NUMBER values typedef int varnumber_T; @@ -423,6 +424,23 @@ static inline bool tv_is_func(const typval_T tv) return tv.v_type == VAR_FUNC || tv.v_type == VAR_PARTIAL; } +/// Specify that argument needs to be translated +/// +/// Used for size_t length arguments to avoid calling gettext() and strlen() +/// unless needed. +#define TV_TRANSLATE (SIZE_MAX) + +/// Specify that argument is a NUL-terminated C string +/// +/// Used for size_t length arguments to avoid calling strlen() unless needed. +#define TV_CSTRING (SIZE_MAX - 1) + +#ifdef UNIT_TESTING +// Do not use enum constants, see commit message. +EXTERN const size_t kTVCstring INIT(= TV_CSTRING); +EXTERN const size_t kTVTranslate INIT(= TV_TRANSLATE); +#endif + #ifdef INCLUDE_GENERATED_DECLARATIONS # include "eval/typval.h.generated.h" #endif |