diff options
author | ZyX <kp-pav@yandex.ru> | 2016-12-25 20:54:06 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-01-03 06:39:23 +0300 |
commit | b3163d06b340b95ca85421cff8a64c5bc1935f5e (patch) | |
tree | 78e8d8660036225f4488a17b80d2d6d772d6abf9 /src/nvim/api/private/helpers.c | |
parent | c5c75513b81398f05a4e63b2f7207ae74de25ecc (diff) | |
download | rneovim-b3163d06b340b95ca85421cff8a64c5bc1935f5e.tar.gz rneovim-b3163d06b340b95ca85421cff8a64c5bc1935f5e.tar.bz2 rneovim-b3163d06b340b95ca85421cff8a64c5bc1935f5e.zip |
eval/typval_encode: Refactor big-big macros into .c.h file
This makes gdb backtraces much more meaningful: specifically I now know at which
line it crashes in place of seeing that it crashes at
TYPVAL_ENCODE_DEFINE_CONV_FUNCTIONS macros invocation.
Diffstat (limited to 'src/nvim/api/private/helpers.c')
-rw-r--r-- | src/nvim/api/private/helpers.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c index 0d1d88055f..ceb950c489 100644 --- a/src/nvim/api/private/helpers.c +++ b/src/nvim/api/private/helpers.c @@ -19,7 +19,6 @@ #include "nvim/option.h" #include "nvim/option_defs.h" #include "nvim/version.h" -#include "nvim/eval/typval_encode.h" #include "nvim/lib/kvec.h" /// Helper structure for vim_to_object @@ -476,9 +475,17 @@ static inline void typval_encode_dict_end(EncodedData *const edata) #define TYPVAL_ENCODE_CONV_RECURSE(val, conv_type) \ TYPVAL_ENCODE_CONV_NIL() -// object_convert_one_value() +#define TYPVAL_ENCODE_SCOPE static +#define TYPVAL_ENCODE_NAME object +#define TYPVAL_ENCODE_FIRST_ARG_TYPE EncodedData *const +#define TYPVAL_ENCODE_FIRST_ARG_NAME edata +// _object_convert_one_value() // encode_vim_to_object() -TYPVAL_ENCODE_DEFINE_CONV_FUNCTIONS(static, object, EncodedData *const, edata) +#include "nvim/eval/typval_encode.c.h" +#undef TYPVAL_ENCODE_SCOPE +#undef TYPVAL_ENCODE_NAME +#undef TYPVAL_ENCODE_FIRST_ARG_TYPE +#undef TYPVAL_ENCODE_FIRST_ARG_NAME #undef TYPVAL_ENCODE_CONV_STRING #undef TYPVAL_ENCODE_CONV_STR_STRING @@ -513,7 +520,9 @@ TYPVAL_ENCODE_DEFINE_CONV_FUNCTIONS(static, object, EncodedData *const, edata) Object vim_to_object(typval_T *obj) { EncodedData edata = { .stack = KV_INITIAL_VALUE }; - encode_vim_to_object(&edata, obj, "vim_to_object argument"); + const int evo_ret = encode_vim_to_object(&edata, obj, + "vim_to_object argument"); + assert(evo_ret == OK); Object ret = kv_A(edata.stack, 0); assert(kv_size(edata.stack) == 1); kv_destroy(edata.stack); |