diff src/syntax.c @ 16764:ef00b6bc186b v8.1.1384

patch 8.1.1384: using "int" for alloc() often results in compiler warnings commit https://github.com/vim/vim/commit/964b3746b9c81e65887e2ac9a335f181db2bb592 Author: Bram Moolenaar <Bram@vim.org> Date: Fri May 24 18:54:09 2019 +0200 patch 8.1.1384: using "int" for alloc() often results in compiler warnings Problem: Using "int" for alloc() often results in compiler warnings. Solution: Use "size_t" and remove type casts. Remove alloc_check(), Vim only works with 32 bit ints anyway.
author Bram Moolenaar <Bram@vim.org>
date Fri, 24 May 2019 19:00:07 +0200
parents 96e93765d0d6
children 695d9ef00b03
line wrap: on
line diff
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -4757,7 +4757,7 @@ syn_incl_toplevel(int id, int *flagsp)
     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 = (short *)alloc(2 * sizeof(short));
 	int	    tlg_id = curwin->w_s->b_syn_topgrp - SYNID_CLUSTER;
 
 	if (grp_list != NULL)
@@ -4872,7 +4872,7 @@ syn_cmd_keyword(exarg_T *eap, int syncin
 	    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 = alloc(STRLEN(rest) + 1);
 	if (keyword_copy != NULL)
 	{
 	    syn_opt_arg.flags = 0;
@@ -5208,7 +5208,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 = (struct pat_ptr *)alloc(sizeof(struct pat_ptr));
 	    if (ppp == NULL)
 	    {
 		rest = NULL;
@@ -5465,7 +5465,7 @@ syn_combine_list(short **clstr1, short *
 		clstr = NULL;
 		break;
 	    }
-	    clstr = (short *)alloc((unsigned)((count + 1) * sizeof(short)));
+	    clstr = (short *)alloc((count + 1) * sizeof(short));
 	    if (clstr == NULL)
 		break;
 	    clstr[count] = 0;
@@ -6124,7 +6124,7 @@ get_id_list(
 	    break;
 	if (round == 1)
 	{
-	    retval = (short *)alloc((unsigned)((count + 1) * sizeof(short)));
+	    retval = (short *)alloc((count + 1) * sizeof(short));
 	    if (retval == NULL)
 		break;
 	    retval[count] = 0;	    /* zero means end of the list */
@@ -6163,7 +6163,7 @@ copy_id_list(short *list)
     for (count = 0; list[count]; ++count)
 	;
     len = (count + 1) * sizeof(short);
-    retval = (short *)alloc((unsigned)len);
+    retval = (short *)alloc(len);
     if (retval != NULL)
 	mch_memmove(retval, list, (size_t)len);
 
@@ -7167,7 +7167,7 @@ load_colors(char_u *name)
 	return OK;
 
     recursive = TRUE;
-    buf = alloc((unsigned)(STRLEN(name) + 12));
+    buf = alloc(STRLEN(name) + 12);
     if (buf != NULL)
     {
 	apply_autocmds(EVENT_COLORSCHEMEPRE, name,