aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-05-23 15:49:48 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-05-23 16:06:59 -0300
commit9815688fbdeb7bc1f1a28b9d827b31eea4fe8cfb (patch)
tree012ef17ffa54f65a175ab994e39d6e31e914a29b /src
parent1156360fe724fd3242186ededd8b3d4a42c990cd (diff)
downloadrneovim-9815688fbdeb7bc1f1a28b9d827b31eea4fe8cfb.tar.gz
rneovim-9815688fbdeb7bc1f1a28b9d827b31eea4fe8cfb.tar.bz2
rneovim-9815688fbdeb7bc1f1a28b9d827b31eea4fe8cfb.zip
API: Refactor: Use macro for initializing all arrays
Diffstat (limited to 'src')
-rw-r--r--src/nvim/api/buffer.c4
-rw-r--r--src/nvim/api/private/defs.h1
-rw-r--r--src/nvim/api/tabpage.c2
-rw-r--r--src/nvim/api/vim.c8
-rw-r--r--src/nvim/os/msgpack_rpc.h2
5 files changed, 8 insertions, 9 deletions
diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c
index 0796f5a324..929735a6b9 100644
--- a/src/nvim/api/buffer.c
+++ b/src/nvim/api/buffer.c
@@ -71,7 +71,7 @@ void buffer_set_line(Buffer buffer, Integer index, String line, Error *err)
void buffer_del_line(Buffer buffer, Integer index, Error *err)
{
- StringArray array = {.size = 0};
+ StringArray array = ARRAY_DICT_INIT;
buffer_set_slice(buffer, index, index, true, true, array, err);
}
@@ -82,7 +82,7 @@ StringArray buffer_get_slice(Buffer buffer,
Boolean include_end,
Error *err)
{
- StringArray rv = {.size = 0};
+ StringArray rv = ARRAY_DICT_INIT;
buf_T *buf = find_buffer(buffer, err);
if (!buf) {
diff --git a/src/nvim/api/private/defs.h b/src/nvim/api/private/defs.h
index 6be786b15a..a91907f4f8 100644
--- a/src/nvim/api/private/defs.h
+++ b/src/nvim/api/private/defs.h
@@ -5,6 +5,7 @@
#include <stdbool.h>
#include <string.h>
+#define ARRAY_DICT_INIT {.size = 0, .items = NULL}
#define REMOTE_TYPE(type) typedef uint64_t type
#define TYPED_ARRAY_OF(type) \
diff --git a/src/nvim/api/tabpage.c b/src/nvim/api/tabpage.c
index 58efc6a514..b7243c68a8 100644
--- a/src/nvim/api/tabpage.c
+++ b/src/nvim/api/tabpage.c
@@ -10,7 +10,7 @@
WindowArray tabpage_get_windows(Tabpage tabpage, Error *err)
{
- WindowArray rv = {.size = 0};
+ WindowArray rv = ARRAY_DICT_INIT;
tabpage_T *tab = find_tab(tabpage, err);
if (!tab) {
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index d9a5ce1db5..694781e0a3 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -81,7 +81,7 @@ Integer vim_strwidth(String str, Error *err)
StringArray vim_list_runtime_paths(void)
{
- StringArray rv = {.size = 0};
+ StringArray rv = ARRAY_DICT_INIT;
uint8_t *rtp = p_rtp;
if (*rtp == NUL) {
@@ -192,7 +192,7 @@ void vim_err_write(String str)
BufferArray vim_get_buffers(void)
{
- BufferArray rv = {.size = 0};
+ BufferArray rv = ARRAY_DICT_INIT;
buf_T *b = firstbuf;
while (b) {
@@ -242,7 +242,7 @@ void vim_set_current_buffer(Buffer buffer, Error *err)
WindowArray vim_get_windows(void)
{
- WindowArray rv = {.size = 0};
+ WindowArray rv = ARRAY_DICT_INIT;
tabpage_T *tp;
win_T *wp;
@@ -289,7 +289,7 @@ void vim_set_current_window(Window window, Error *err)
TabpageArray vim_get_tabpages(void)
{
- TabpageArray rv = {.size = 0};
+ TabpageArray rv = ARRAY_DICT_INIT;
tabpage_T *tp = first_tabpage;
while (tp) {
diff --git a/src/nvim/os/msgpack_rpc.h b/src/nvim/os/msgpack_rpc.h
index 80c5a6914f..a6a909ac1f 100644
--- a/src/nvim/os/msgpack_rpc.h
+++ b/src/nvim/os/msgpack_rpc.h
@@ -8,8 +8,6 @@
#include "nvim/api/private/defs.h"
-#define ARRAY_DICT_INIT {.size = 0, .items = NULL}
-
/// Validates the basic structure of the msgpack-rpc call and fills `res`
/// with the basic response structure.
///