aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/vim.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-06-27 02:29:15 +0200
committerGitHub <noreply@github.com>2017-06-27 02:29:15 +0200
commitf34befe74c5a7b18a802f6f3c79607cb2124004c (patch)
tree955fc4456e7710213f7339e95cd40464088c08ec /src/nvim/api/vim.c
parent1ef2d768e71981e4429376a0cb25dbed14dfae52 (diff)
parentcab3a248b2704e8f188eaf20206f2c87d1a76c0d (diff)
downloadrneovim-f34befe74c5a7b18a802f6f3c79607cb2124004c.tar.gz
rneovim-f34befe74c5a7b18a802f6f3c79607cb2124004c.tar.bz2
rneovim-f34befe74c5a7b18a802f6f3c79607cb2124004c.zip
Merge #6789 from ZyX-I/lua-path
lua: Add paths from &runtimepath to package.path and package.cpath
Diffstat (limited to 'src/nvim/api/vim.c')
-rw-r--r--src/nvim/api/vim.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index 92985b412a..80efe86ea3 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -300,7 +300,7 @@ ArrayOf(String) nvim_list_runtime_paths(void)
FUNC_API_SINCE(1)
{
Array rv = ARRAY_DICT_INIT;
- uint8_t *rtp = p_rtp;
+ char_u *rtp = p_rtp;
if (*rtp == NUL) {
// No paths
@@ -314,13 +314,14 @@ ArrayOf(String) nvim_list_runtime_paths(void)
}
rtp++;
}
+ rv.size++;
// Allocate memory for the copies
- rv.items = xmalloc(sizeof(Object) * rv.size);
+ rv.items = xmalloc(sizeof(*rv.items) * rv.size);
// Reset the position
rtp = p_rtp;
// Start copying
- for (size_t i = 0; i < rv.size && *rtp != NUL; i++) {
+ for (size_t i = 0; i < rv.size; i++) {
rv.items[i].type = kObjectTypeString;
rv.items[i].data.string.data = xmalloc(MAXPATHL);
// Copy the path from 'runtimepath' to rv.items[i]
@@ -709,7 +710,7 @@ void nvim_unsubscribe(uint64_t channel_id, String event)
Integer nvim_get_color_by_name(String name)
FUNC_API_SINCE(1)
{
- return name_to_color((uint8_t *)name.data);
+ return name_to_color((char_u *)name.data);
}
Dictionary nvim_get_color_map(void)
@@ -871,7 +872,7 @@ static void write_msg(String message, bool to_err)
#define PUSH_CHAR(i, pos, line_buf, msg) \
if (message.data[i] == NL || pos == LINE_BUFFER_SIZE - 1) { \
line_buf[pos] = NUL; \
- msg((uint8_t *)line_buf); \
+ msg((char_u *)line_buf); \
pos = 0; \
continue; \
} \