mirror of
https://github.com/neovim/neovim.git
synced 2025-10-01 23:48:32 +00:00
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:
@@ -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)
|
||||
|
Reference in New Issue
Block a user