aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/syntax.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/syntax.c')
-rw-r--r--src/nvim/syntax.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index 2b1f35d72d..ccc6752793 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -3924,7 +3924,6 @@ add_keyword (
int conceal_char
)
{
- keyentry_T *kp;
hashtab_T *ht;
hashitem_T *hi;
char_u *name_ic;
@@ -3936,7 +3935,7 @@ add_keyword (
name_folded, MAXKEYWLEN + 1);
else
name_ic = name;
- kp = (keyentry_T *)alloc((int)(sizeof(keyentry_T) + STRLEN(name_ic)));
+ keyentry_T *kp = xmalloc(sizeof(keyentry_T) + STRLEN(name_ic));
STRCPY(kp->keyword, name_ic);
kp->k_syn.id = id;
kp->k_syn.inc_tag = current_syn_inc_tag;
@@ -4154,7 +4153,7 @@ static void syn_incl_toplevel(int id, int *flagsp)
*flagsp |= HL_CONTAINED;
if (curwin->w_s->b_syn_topgrp >= SYNID_CLUSTER) {
/* We have to alloc this, because syn_combine_list() will free it. */
- short *grp_list = (short *)alloc((unsigned)(2 * sizeof(short)));
+ short *grp_list = xmalloc(2 * sizeof(short));
int tlg_id = curwin->w_s->b_syn_topgrp - SYNID_CLUSTER;
grp_list[0] = id;
@@ -4255,7 +4254,7 @@ static void syn_cmd_keyword(exarg_T *eap, int syncing)
syn_id = syn_check_group(arg, (int)(group_name_end - arg));
if (syn_id != 0)
/* allocate a buffer, for removing backslashes in the keyword */
- keyword_copy = alloc((unsigned)STRLEN(rest) + 1);
+ keyword_copy = xmalloc(STRLEN(rest) + 1);
syn_opt_arg.flags = 0;
syn_opt_arg.keyword = TRUE;
syn_opt_arg.sync_idx = NULL;
@@ -4556,7 +4555,7 @@ syn_cmd_region (
* syn_patterns for this item, at the start (because the list is
* used from end to start).
*/
- ppp = (struct pat_ptr *)alloc((unsigned)sizeof(struct pat_ptr));
+ ppp = xmalloc(sizeof(struct pat_ptr));
ppp->pp_next = pat_ptrs[item];
pat_ptrs[item] = ppp;
ppp->pp_synp = xcalloc(1, sizeof(synpat_T));
@@ -4782,7 +4781,7 @@ static void syn_combine_list(short **clstr1, short **clstr2, int list_op)
clstr = NULL;
break;
}
- clstr = (short *)alloc((unsigned)((count + 1) * sizeof(short)));
+ clstr = xmalloc((count + 1) * sizeof(short));
clstr[count] = 0;
}
}
@@ -5231,7 +5230,7 @@ get_id_list (
while (!ends_excmd(*p)) {
for (end = p; *end && !vim_iswhite(*end) && *end != ','; ++end)
;
- name = alloc((int)(end - p + 3)); /* leave room for "^$" */
+ name = xmalloc((int)(end - p + 3)); /* leave room for "^$" */
vim_strncpy(name + 1, p, end - p);
if ( STRCMP(name + 1, "ALLBUT") == 0
|| STRCMP(name + 1, "ALL") == 0
@@ -5325,7 +5324,7 @@ get_id_list (
if (failed)
break;
if (round == 1) {
- retval = (short *)alloc((unsigned)((count + 1) * sizeof(short)));
+ retval = xmalloc((count + 1) * sizeof(short));
retval[count] = 0; /* zero means end of the list */
total_count = count;
}
@@ -5360,7 +5359,7 @@ static short *copy_id_list(short *list)
for (count = 0; list[count]; ++count)
;
len = (count + 1) * sizeof(short);
- retval = (short *)alloc((unsigned)len);
+ retval = xmalloc(len);
memmove(retval, list, (size_t)len);
return retval;
@@ -5530,7 +5529,7 @@ void ex_ownsyntax(exarg_T *eap)
char_u *new_value;
if (curwin->w_s == &curwin->w_buffer->b_s) {
- curwin->w_s = (synblock_T *)alloc(sizeof(synblock_T));
+ curwin->w_s = xmalloc(sizeof(synblock_T));
memset(curwin->w_s, 0, sizeof(synblock_T));
curwin->w_p_spell = FALSE; /* No spell checking */
clear_string_option(&curwin->w_s->b_p_spc);
@@ -6170,7 +6169,7 @@ int load_colors(char_u *name)
return OK;
recursive = TRUE;
- buf = alloc((unsigned)(STRLEN(name) + 12));
+ buf = xmalloc(STRLEN(name) + 12);
sprintf((char *)buf, "colors/%s.vim", name);
retval = source_runtime(buf, FALSE);
free(buf);