diff options
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/src/eval.c b/src/eval.c index 09e1f8b4aa..9506dd989e 100644 --- a/src/eval.c +++ b/src/eval.c @@ -6105,23 +6105,21 @@ void set_ref_in_item(typval_T *tv, int copyID) */ dict_T *dict_alloc(void) { - dict_T *d; - - d = (dict_T *)alloc(sizeof(dict_T)); - if (d != NULL) { - /* Add the dict to the list of dicts for garbage collection. */ - if (first_dict != NULL) - first_dict->dv_used_prev = d; - d->dv_used_next = first_dict; - d->dv_used_prev = NULL; - first_dict = d; - - hash_init(&d->dv_hashtab); - d->dv_lock = 0; - d->dv_scope = 0; - d->dv_refcount = 0; - d->dv_copyID = 0; - } + dict_T *d = xmalloc(sizeof(dict_T)); + + /* Add the dict to the list of dicts for garbage collection. */ + if (first_dict != NULL) + first_dict->dv_used_prev = d; + d->dv_used_next = first_dict; + d->dv_used_prev = NULL; + first_dict = d; + + hash_init(&d->dv_hashtab); + d->dv_lock = 0; + d->dv_scope = 0; + d->dv_refcount = 0; + d->dv_copyID = 0; + return d; } |