Initialize Object, Position

fix #778
thanks @genisaguilar
This commit is contained in:
Justin M. Keyes
2014-05-31 09:08:58 -04:00
parent 4e1ca460e3
commit 005a4254c0
5 changed files with 15 additions and 21 deletions

View File

@@ -7,6 +7,8 @@
#define ARRAY_DICT_INIT {.size = 0, .items = NULL}
#define STRING_INIT {.data = NULL, .size = 0}
#define OBJECT_INIT { .type = kObjectTypeNil }
#define POSITION_INIT { .row = 0, .col = 0 }
#define REMOTE_TYPE(type) typedef uint64_t type
#define TYPED_ARRAY_OF(type) \

View File

@@ -83,7 +83,7 @@ bool try_end(Error *err)
Object dict_get_value(dict_T *dict, String key, Error *err)
{
Object rv;
Object rv = OBJECT_INIT;
hashitem_T *hi;
dictitem_T *di;
char *k = xstrndup(key.data, key.size);
@@ -103,7 +103,7 @@ Object dict_get_value(dict_T *dict, String key, Error *err)
Object dict_set_value(dict_T *dict, String key, Object value, Error *err)
{
Object rv = {.type = kObjectTypeNil};
Object rv = OBJECT_INIT;
if (dict->dv_lock) {
set_api_error("Dictionary is locked", err);
@@ -166,7 +166,7 @@ Object dict_set_value(dict_T *dict, String key, Object value, Error *err)
Object get_option_from(void *from, int type, String name, Error *err)
{
Object rv = {.type = kObjectTypeNil};
Object rv = OBJECT_INIT;
if (name.size == 0) {
set_api_error("Empty option name", err);
@@ -424,7 +424,7 @@ static bool object_to_vim(Object obj, typval_T *tv, Error *err)
static Object vim_to_object_rec(typval_T *obj, PMap(ptr_t) *lookup)
{
Object rv = {.type = kObjectTypeNil};
Object rv = OBJECT_INIT;
if (obj->v_type == VAR_LIST || obj->v_type == VAR_DICT) {
// Container object, add it to the lookup table