From 4e1b364a3e255742522d4d76c5ccddd7a36c1769 Mon Sep 17 00:00:00 2001 From: John Schmidt Date: Tue, 22 Apr 2014 11:35:11 +0200 Subject: Remove `alloc_clear` Use `xcalloc` instead. Inline `alloc_tv` and `alloc_string_tv` in eval.c --- src/buffer.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src/buffer.c') 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 -- cgit