API: Refactor: Use macro for initializing all arrays

This commit is contained in:
Thiago de Arruda 2014-05-23 15:49:48 -03:00
parent 1156360fe7
commit 9815688fbd
5 changed files with 8 additions and 9 deletions

View File

@ -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) {

View File

@ -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) \

View File

@ -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) {

View File

@ -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) {

View File

@ -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.
///