aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2021-08-02 19:13:48 +0100
committerSean Dewar <seandewar@users.noreply.github.com>2021-09-15 21:19:29 +0100
commit312c783d81544df7ab3342f4b3316ced931e89b8 (patch)
treeea23894ef5cca92793671df9c8e3be5fee73a6f0 /src
parent10aa60e806c300cc7bd1f84e52b4b043d6fac537 (diff)
downloadrneovim-312c783d81544df7ab3342f4b3316ced931e89b8.tar.gz
rneovim-312c783d81544df7ab3342f4b3316ced931e89b8.tar.bz2
rneovim-312c783d81544df7ab3342f4b3316ced931e89b8.zip
feat(api): convert Blobs to API strings
Note that these are not NUL-terminated; the API supports this.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/api/private/helpers.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c
index 6ece819afa..ecbd4e13a3 100644
--- a/src/nvim/api/private/helpers.c
+++ b/src/nvim/api/private/helpers.c
@@ -445,7 +445,14 @@ void set_option_to(uint64_t channel_id, void *to, int type,
TYPVAL_ENCODE_CONV_NIL(tv)
#define TYPVAL_ENCODE_CONV_BLOB(tv, blob, len) \
- abort() /* TODO(seandewar) */ \
+ do { \
+ const size_t len_ = (size_t)(len); \
+ const blob_T *const blob_ = (blob); \
+ kvi_push(edata->stack, STRING_OBJ(((String) { \
+ .data = len_ != 0 ? xmemdup(blob_->bv_ga.ga_data, len_) : NULL, \
+ .size = len_ \
+ }))); \
+ } while (0)
#define TYPVAL_ENCODE_CONV_FUNC_START(tv, fun) \
do { \