Replace alloc() with xmalloc() and remove immediate OOM checks

This commit is contained in:
Felipe Oliveira Carvalho
2014-05-09 03:30:26 -03:00
parent a80d7e86c1
commit 21784aeb00
42 changed files with 413 additions and 640 deletions

View File

@@ -2983,8 +2983,7 @@ void add_termcode(char_u *name, char_u *string, int flags)
*/
if (tc_len == tc_max_len) {
tc_max_len += 20;
new_tc = (struct termcode *)alloc(
(unsigned)(tc_max_len * sizeof(struct termcode)));
new_tc = xmalloc(tc_max_len * sizeof(struct termcode));
for (i = 0; i < tc_len; ++i)
new_tc[i] = termcodes[i];
free(termcodes);
@@ -4170,7 +4169,7 @@ replace_termcodes (
* Allocate space for the translation. Worst case a single character is
* replaced by 6 bytes (shifted special key), plus a NUL at the end.
*/
result = alloc((unsigned)STRLEN(from) * 6 + 1);
result = xmalloc(STRLEN(from) * 6 + 1);
src = from;
@@ -4376,7 +4375,7 @@ void show_termcodes(void)
if (tc_len == 0) /* no terminal codes (must be GUI) */
return;
items = (int *)alloc((unsigned)(sizeof(int) * tc_len));
items = xmalloc(sizeof(int) * tc_len);
/* Highlight title */
MSG_PUTS_TITLE(_("\n--- Terminal keys ---"));