Replace 'alloc' with 'xmalloc' in some files.

Files changed: charset.c, buffer.c, diff.c, edit.c,
ex_cmds.c, ex_cmds2.c and ex_docmd.c.

The remaining alloc's in these files require more careful attention to
remove.
This commit is contained in:
Chris Watkins
2014-04-27 10:48:08 -07:00
committed by Justin M. Keyes
parent 1b5217687a
commit 67a157c08d
7 changed files with 177 additions and 259 deletions

View File

@@ -1843,7 +1843,7 @@ int ExpandBufnames(char_u *pat, int *num_file, char_u ***file, int options)
/* Make a copy of "pat" and change "^" to "\(^\|[\/]\)". */
if (*pat == '^') {
patc = alloc((unsigned)STRLEN(pat) + 11);
patc = xmalloc(STRLEN(pat) + 11);
STRCPY(patc, "\\(^\\|[\\/]\\)");
STRCPY(patc + 11, pat + 1);
} else
@@ -1888,7 +1888,7 @@ int ExpandBufnames(char_u *pat, int *num_file, char_u ***file, int options)
if (count == 0) /* no match found, break here */
break;
if (round == 1) {
*file = (char_u **)alloc((unsigned)(count * sizeof(char_u *)));
*file = xmalloc(count * sizeof(**file));
}
}
vim_regfree(prog);
@@ -2520,7 +2520,7 @@ fileinfo (
char_u *buffer;
size_t len;
buffer = alloc(IOSIZE);
buffer = xmalloc(IOSIZE);
if (fullname > 1) { /* 2 CTRL-G: include buffer number */
vim_snprintf((char *)buffer, IOSIZE, "buf %d: ", curbuf->b_fnum);
@@ -4285,7 +4285,7 @@ void write_viminfo_bufferlist(FILE *fp)
/* Allocate room for the file name, lnum and col. */
#define LINE_BUF_LEN (MAXPATHL + 40)
line = alloc(LINE_BUF_LEN);
line = xmalloc(LINE_BUF_LEN);
FOR_ALL_TAB_WINDOWS(tp, win)
set_last_cursor(win);