aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/private
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/api/private')
-rw-r--r--src/nvim/api/private/converter.c2
-rw-r--r--src/nvim/api/private/helpers.c5
-rw-r--r--src/nvim/api/private/helpers.h16
3 files changed, 13 insertions, 10 deletions
diff --git a/src/nvim/api/private/converter.c b/src/nvim/api/private/converter.c
index 3d4ff202fe..49e3cf7df7 100644
--- a/src/nvim/api/private/converter.c
+++ b/src/nvim/api/private/converter.c
@@ -57,7 +57,7 @@ typedef struct {
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, \
+ .data = len_ != 0 ? xmemdupz(blob_->bv_ga.ga_data, len_) : xstrdup(""), \
.size = len_ \
}))); \
} while (0)
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c
index 5198b00f65..35e8589255 100644
--- a/src/nvim/api/private/helpers.c
+++ b/src/nvim/api/private/helpers.c
@@ -406,6 +406,7 @@ void set_option_to(uint64_t channel_id, void *to, int type, String name, Object
});
}
+
buf_T *find_buffer_by_handle(Buffer buffer, Error *err)
{
if (buffer == 0) {
@@ -1617,8 +1618,8 @@ int find_sid(uint64_t channel_id)
{
switch (channel_id) {
case VIML_INTERNAL_CALL:
- // TODO(autocmd): Figure out what this should be
- // return SID_API_CLIENT;
+ // TODO(autocmd): Figure out what this should be
+ // return SID_API_CLIENT;
case LUA_INTERNAL_CALL:
return SID_LUA;
default:
diff --git a/src/nvim/api/private/helpers.h b/src/nvim/api/private/helpers.h
index 6969994c3b..bc7c2e6a60 100644
--- a/src/nvim/api/private/helpers.h
+++ b/src/nvim/api/private/helpers.h
@@ -152,13 +152,15 @@ typedef struct {
#endif
#define WITH_SCRIPT_CONTEXT(channel_id, code) \
- const sctx_T save_current_sctx = current_sctx; \
- current_sctx.sc_sid = \
- (channel_id) == LUA_INTERNAL_CALL ? SID_LUA : SID_API_CLIENT; \
- current_sctx.sc_lnum = 0; \
- current_channel_id = channel_id; \
- code; \
- current_sctx = save_current_sctx;
+ do { \
+ const sctx_T save_current_sctx = current_sctx; \
+ current_sctx.sc_sid = \
+ (channel_id) == LUA_INTERNAL_CALL ? SID_LUA : SID_API_CLIENT; \
+ current_sctx.sc_lnum = 0; \
+ current_channel_id = channel_id; \
+ code; \
+ current_sctx = save_current_sctx; \
+ } while (0);
#endif // NVIM_API_PRIVATE_HELPERS_H