diff options
author | John Schmidt <john.schmidt.h@gmail.com> | 2014-04-22 11:35:11 +0200 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-04-28 07:41:45 -0300 |
commit | 4e1b364a3e255742522d4d76c5ccddd7a36c1769 (patch) | |
tree | 667a250396bc009ec56f3dad563882b9367b4441 /src/buffer.c | |
parent | c70a526a5df2b8a7353c3c71e241cd51bf099a64 (diff) | |
download | rneovim-4e1b364a3e255742522d4d76c5ccddd7a36c1769.tar.gz rneovim-4e1b364a3e255742522d4d76c5ccddd7a36c1769.tar.bz2 rneovim-4e1b364a3e255742522d4d76c5ccddd7a36c1769.zip |
Remove `alloc_clear`
Use `xcalloc` instead.
Inline `alloc_tv` and `alloc_string_tv` in eval.c
Diffstat (limited to 'src/buffer.c')
-rw-r--r-- | src/buffer.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/buffer.c b/src/buffer.c index 3af7df19f1..dfa7ecb6ee 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1378,14 +1378,9 @@ buflist_new ( } } if (buf != curbuf || curbuf == NULL) { - buf = (buf_T *)alloc_clear((unsigned)sizeof(buf_T)); + buf = xcalloc(1, sizeof(buf_T)); /* init b: variables */ buf->b_vars = dict_alloc(); - if (buf->b_vars == NULL) { - vim_free(ffname); - vim_free(buf); - return NULL; - } init_var_dict(buf->b_vars, &buf->b_bufvar, VAR_SCOPE); } @@ -1395,7 +1390,7 @@ buflist_new ( } clear_wininfo(buf); - buf->b_wininfo = (wininfo_T *)alloc_clear((unsigned)sizeof(wininfo_T)); + buf->b_wininfo = xcalloc(1, sizeof(wininfo_T)); if (ffname != NULL && (buf->b_ffname == NULL || buf->b_sfname == NULL)) { vim_free(buf->b_ffname); @@ -2004,7 +1999,7 @@ static void buflist_setfpos(buf_T *buf, win_T *win, linenr_T lnum, colnr_T col, break; if (wip == NULL) { /* allocate a new entry */ - wip = (wininfo_T *)alloc_clear((unsigned)sizeof(wininfo_T)); + wip = xcalloc(1, sizeof(wininfo_T)); wip->wi_win = win; if (lnum == 0) /* set lnum even when it's 0 */ lnum = 1; @@ -3699,7 +3694,7 @@ do_arg_all ( setpcmark(); opened_len = ARGCOUNT; - opened = alloc_clear((unsigned)opened_len); + opened = xcalloc(opened_len, 1); /* Autocommands may do anything to the argument list. Make sure it's not * freed while we are working here by "locking" it. We still have to |