diff options
| author | bfredl <bjorn.linse@gmail.com> | 2024-06-27 18:45:18 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-27 18:45:18 +0200 |
| commit | 46187117c9464dd6c09eae8e47bb279d72a01038 (patch) | |
| tree | cffb3d6a5b9875893ae4de6457a656542856dc93 /src/nvim/api | |
| parent | 724d1110b1e4699a34f489e9cdb2d25098746499 (diff) | |
| parent | bda63d5b97dfb333de6f4bd757dbb978906062a2 (diff) | |
| download | rneovim-46187117c9464dd6c09eae8e47bb279d72a01038.tar.gz rneovim-46187117c9464dd6c09eae8e47bb279d72a01038.tar.bz2 rneovim-46187117c9464dd6c09eae8e47bb279d72a01038.zip | |
Merge pull request #29483 from bfredl/nonbinary
refactor(typval)!: remove binary distinction of binary and nonbinary strings
Diffstat (limited to 'src/nvim/api')
| -rw-r--r-- | src/nvim/api/private/converter.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/nvim/api/private/converter.c b/src/nvim/api/private/converter.c index 0a4daf1dae..a1c5816a49 100644 --- a/src/nvim/api/private/converter.c +++ b/src/nvim/api/private/converter.c @@ -7,7 +7,9 @@ #include "nvim/api/private/converter.h" #include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" +#include "nvim/ascii_defs.h" #include "nvim/assert_defs.h" +#include "nvim/eval/decode.h" #include "nvim/eval/typval.h" #include "nvim/eval/typval_defs.h" #include "nvim/eval/userfunc.h" @@ -302,15 +304,11 @@ void object_to_vim_take_luaref(Object *obj, typval_T *tv, bool take_luaref, Erro tv->vval.v_float = obj->data.floating; break; - case kObjectTypeString: - tv->v_type = VAR_STRING; - if (obj->data.string.data == NULL) { - tv->vval.v_string = NULL; - } else { - tv->vval.v_string = xmemdupz(obj->data.string.data, - obj->data.string.size); - } + case kObjectTypeString: { + String s = obj->data.string; + *tv = decode_string(s.data, s.size, false, false); break; + } case kObjectTypeArray: { list_T *const list = tv_list_alloc((ptrdiff_t)obj->data.array.size); |