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

@@ -335,13 +335,13 @@ char_u *transstr(char_u *s)
{
char_u *res;
char_u *p;
int l, len, c;
int l, c;
char_u hexbuf[11];
if (has_mbyte) {
// Compute the length of the result, taking account of unprintable
// multi-byte characters.
len = 0;
size_t len = 0;
p = s;
while (*p != NUL) {
@@ -353,7 +353,7 @@ char_u *transstr(char_u *s)
len += l;
} else {
transchar_hex(hexbuf, c);
len += (int)STRLEN(hexbuf);
len += STRLEN(hexbuf);
}
} else {
l = byte2cells(*p++);
@@ -366,9 +366,9 @@ char_u *transstr(char_u *s)
}
}
}
res = alloc((unsigned)(len + 1));
res = xmallocz(len);
} else {
res = alloc((unsigned)(vim_strsize(s) + 1));
res = xmallocz(vim_strsize(s));
}
*res = NUL;