mirror of
https://github.com/neovim/neovim.git
synced 2025-10-03 08:28:34 +00:00
Merge #3135 'Use proper refcount of msgpack type lists'.
This commit is contained in:
@@ -4654,7 +4654,8 @@ msgpackparse({list}) {Nvim} *msgpackparse()*
|
|||||||
let fname = expand('~/.nvim/shada/main.shada')
|
let fname = expand('~/.nvim/shada/main.shada')
|
||||||
let mpack = readfile(fname, 'b')
|
let mpack = readfile(fname, 'b')
|
||||||
let shada_objects = msgpackparse(mpack)
|
let shada_objects = msgpackparse(mpack)
|
||||||
< This will read |shada-file| to `shada_objects` list.
|
< This will read ~/.nvim/shada/main.shada file to
|
||||||
|
`shada_objects` list.
|
||||||
|
|
||||||
Limitations:
|
Limitations:
|
||||||
1. Mapping ordering is not preserved unless messagepack
|
1. Mapping ordering is not preserved unless messagepack
|
||||||
@@ -4668,10 +4669,10 @@ msgpackparse({list}) {Nvim} *msgpackparse()*
|
|||||||
Some messagepack strings may be parsed to special
|
Some messagepack strings may be parsed to special
|
||||||
dictionaries. Special dictionaries are dictionaries which
|
dictionaries. Special dictionaries are dictionaries which
|
||||||
|
|
||||||
1. Contain exactly two keys: `_TYPE` and `_VALUE`.
|
1. Contain exactly two keys: `_TYPE` and `_VAL`.
|
||||||
2. `_TYPE` key is one of the types found in |v:msgpack_types|
|
2. `_TYPE` key is one of the types found in |v:msgpack_types|
|
||||||
variable.
|
variable.
|
||||||
3. Value for `_VALUE` has the following format (Key column
|
3. Value for `_VAL` has the following format (Key column
|
||||||
contains name of the key from |v:msgpack_types|):
|
contains name of the key from |v:msgpack_types|):
|
||||||
|
|
||||||
Key Value ~
|
Key Value ~
|
||||||
@@ -4682,9 +4683,9 @@ msgpackparse({list}) {Nvim} *msgpackparse()*
|
|||||||
bits, number with bits from 62nd to 31st, lowest 31
|
bits, number with bits from 62nd to 31st, lowest 31
|
||||||
bits. I.e. to get actual number one will need to use
|
bits. I.e. to get actual number one will need to use
|
||||||
code like >
|
code like >
|
||||||
_VALUE[0] * ((_VALUE[1] << 62)
|
_VAL[0] * ((_VAL[1] << 62)
|
||||||
& (_VALUE[2] << 31)
|
& (_VAL[2] << 31)
|
||||||
& _VALUE[3])
|
& _VAL[3])
|
||||||
< Special dictionary with this type will appear in
|
< Special dictionary with this type will appear in
|
||||||
|msgpackparse()| output under one of the following
|
|msgpackparse()| output under one of the following
|
||||||
circumstances:
|
circumstances:
|
||||||
|
@@ -584,6 +584,7 @@ void eval_init(void)
|
|||||||
for (size_t i = 0; i < ARRAY_SIZE(msgpack_type_names); i++) {
|
for (size_t i = 0; i < ARRAY_SIZE(msgpack_type_names); i++) {
|
||||||
list_T *const type_list = list_alloc();
|
list_T *const type_list = list_alloc();
|
||||||
type_list->lv_lock = VAR_FIXED;
|
type_list->lv_lock = VAR_FIXED;
|
||||||
|
type_list->lv_refcount = 1;
|
||||||
dictitem_T *const di = dictitem_alloc((char_u *) msgpack_type_names[i]);
|
dictitem_T *const di = dictitem_alloc((char_u *) msgpack_type_names[i]);
|
||||||
di->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
|
di->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
|
||||||
di->di_tv = (typval_T) {
|
di->di_tv = (typval_T) {
|
||||||
|
Reference in New Issue
Block a user