aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-01-15 23:35:20 +0100
committerGitHub <noreply@github.com>2018-01-15 23:35:20 +0100
commitde0a9548f7bf55bdf0202a2dcebb86a92f2d989d (patch)
tree47848ab49a0188ddce9d305a187ff638ccb2965b /src/nvim/lua
parent726197d8907891eda99299a2920b0d1d98148a3c (diff)
parenta8cb510a2ed2f53f60ba4b2e722f4bc64954c606 (diff)
downloadrneovim-de0a9548f7bf55bdf0202a2dcebb86a92f2d989d.tar.gz
rneovim-de0a9548f7bf55bdf0202a2dcebb86a92f2d989d.tar.bz2
rneovim-de0a9548f7bf55bdf0202a2dcebb86a92f2d989d.zip
Merge #7806 from ZyX-I/list-stat
Add a way to collect list usage statistics
Diffstat (limited to 'src/nvim/lua')
-rw-r--r--src/nvim/lua/converter.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/nvim/lua/converter.c b/src/nvim/lua/converter.c
index 61cb428923..9e3063b164 100644
--- a/src/nvim/lua/converter.c
+++ b/src/nvim/lua/converter.c
@@ -211,7 +211,7 @@ bool nlua_pop_typval(lua_State *lstate, typval_T *ret_tv)
size_t len;
const char *s = lua_tolstring(lstate, -2, &len);
if (cur.special) {
- list_T *const kv_pair = tv_list_alloc();
+ list_T *const kv_pair = tv_list_alloc(2);
typval_T s_tv = decode_string(s, len, kTrue, false, false);
if (s_tv.v_type == VAR_UNKNOWN) {
@@ -321,7 +321,7 @@ bool nlua_pop_typval(lua_State *lstate, typval_T *ret_tv)
switch (table_props.type) {
case kObjectTypeArray: {
cur.tv->v_type = VAR_LIST;
- cur.tv->vval.v_list = tv_list_alloc();
+ cur.tv->vval.v_list = tv_list_alloc((ptrdiff_t)table_props.maxidx);
tv_list_ref(cur.tv->vval.v_list);
if (table_props.maxidx != 0) {
cur.container = true;
@@ -338,7 +338,8 @@ bool nlua_pop_typval(lua_State *lstate, typval_T *ret_tv)
} else {
cur.special = table_props.has_string_with_nul;
if (table_props.has_string_with_nul) {
- decode_create_map_special_dict(cur.tv);
+ decode_create_map_special_dict(
+ cur.tv, (ptrdiff_t)table_props.string_keys_num);
assert(cur.tv->v_type == VAR_DICT);
dictitem_T *const val_di = tv_dict_find(cur.tv->vval.v_dict,
S_LEN("_VAL"));