api/helpers: Use typval_encode.h for vim_to_object

This ought to prevent stack overflow, but I do not see this actually working:
*lua* code crashes with stack overflow when trying to deserialize msgpack from
Neovim, Neovim is fine even if nesting level is increased 100x (though test
becomes very slow); not sure how recursive function may survive this. So it
looks like there are currently only two positive effects:

1. NULL lists are returned as empty (#4596).
2. Functional tests are slightly more fast. Very slightly. Checked for Release
   build for test/functional/eval tests because benchmarking of debug mode is
   not very useful.
This commit is contained in:
ZyX
2016-04-18 15:55:51 +03:00
parent 47a15d0256
commit da15b5c1f3
5 changed files with 214 additions and 137 deletions

View File

@@ -184,10 +184,12 @@ typedef kvec_t(MPConvStackVal) MPConvStack;
/// @param copyID_attr Name of the container attribute that holds copyID.
/// After checking whether value of this attribute is
/// copyID (variable) it is set to copyID.
/// @param conv_type Type of the conversion, @see MPConvStackValType.
#define _TYPVAL_ENCODE_CHECK_SELF_REFERENCE(val, copyID_attr, conv_type) \
do { \
if ((val)->copyID_attr == copyID) { \
TYPVAL_ENCODE_CONV_RECURSE((val), conv_type); \
return OK; \
} \
(val)->copyID_attr = copyID; \
} while (0)