comparison 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
comparison
equal deleted inserted replaced
16763:fccf84413b53 16764:ef00b6bc186b
4755 return; 4755 return;
4756 *flagsp |= HL_CONTAINED; 4756 *flagsp |= HL_CONTAINED;
4757 if (curwin->w_s->b_syn_topgrp >= SYNID_CLUSTER) 4757 if (curwin->w_s->b_syn_topgrp >= SYNID_CLUSTER)
4758 { 4758 {
4759 /* We have to alloc this, because syn_combine_list() will free it. */ 4759 /* We have to alloc this, because syn_combine_list() will free it. */
4760 short *grp_list = (short *)alloc((unsigned)(2 * sizeof(short))); 4760 short *grp_list = (short *)alloc(2 * sizeof(short));
4761 int tlg_id = curwin->w_s->b_syn_topgrp - SYNID_CLUSTER; 4761 int tlg_id = curwin->w_s->b_syn_topgrp - SYNID_CLUSTER;
4762 4762
4763 if (grp_list != NULL) 4763 if (grp_list != NULL)
4764 { 4764 {
4765 grp_list[0] = id; 4765 grp_list[0] = id;
4870 syn_id = -1; 4870 syn_id = -1;
4871 else 4871 else
4872 syn_id = syn_check_group(arg, (int)(group_name_end - arg)); 4872 syn_id = syn_check_group(arg, (int)(group_name_end - arg));
4873 if (syn_id != 0) 4873 if (syn_id != 0)
4874 /* allocate a buffer, for removing backslashes in the keyword */ 4874 /* allocate a buffer, for removing backslashes in the keyword */
4875 keyword_copy = alloc((unsigned)STRLEN(rest) + 1); 4875 keyword_copy = alloc(STRLEN(rest) + 1);
4876 if (keyword_copy != NULL) 4876 if (keyword_copy != NULL)
4877 { 4877 {
4878 syn_opt_arg.flags = 0; 4878 syn_opt_arg.flags = 0;
4879 syn_opt_arg.keyword = TRUE; 4879 syn_opt_arg.keyword = TRUE;
4880 syn_opt_arg.sync_idx = NULL; 4880 syn_opt_arg.sync_idx = NULL;
5206 /* 5206 /*
5207 * Allocate room for a syn_pattern, and link it in the list of 5207 * Allocate room for a syn_pattern, and link it in the list of
5208 * syn_patterns for this item, at the start (because the list is 5208 * syn_patterns for this item, at the start (because the list is
5209 * used from end to start). 5209 * used from end to start).
5210 */ 5210 */
5211 ppp = (struct pat_ptr *)alloc((unsigned)sizeof(struct pat_ptr)); 5211 ppp = (struct pat_ptr *)alloc(sizeof(struct pat_ptr));
5212 if (ppp == NULL) 5212 if (ppp == NULL)
5213 { 5213 {
5214 rest = NULL; 5214 rest = NULL;
5215 break; 5215 break;
5216 } 5216 }
5463 if (count == 0) 5463 if (count == 0)
5464 { 5464 {
5465 clstr = NULL; 5465 clstr = NULL;
5466 break; 5466 break;
5467 } 5467 }
5468 clstr = (short *)alloc((unsigned)((count + 1) * sizeof(short))); 5468 clstr = (short *)alloc((count + 1) * sizeof(short));
5469 if (clstr == NULL) 5469 if (clstr == NULL)
5470 break; 5470 break;
5471 clstr[count] = 0; 5471 clstr[count] = 0;
5472 } 5472 }
5473 } 5473 }
6122 } 6122 }
6123 if (failed) 6123 if (failed)
6124 break; 6124 break;
6125 if (round == 1) 6125 if (round == 1)
6126 { 6126 {
6127 retval = (short *)alloc((unsigned)((count + 1) * sizeof(short))); 6127 retval = (short *)alloc((count + 1) * sizeof(short));
6128 if (retval == NULL) 6128 if (retval == NULL)
6129 break; 6129 break;
6130 retval[count] = 0; /* zero means end of the list */ 6130 retval[count] = 0; /* zero means end of the list */
6131 total_count = count; 6131 total_count = count;
6132 } 6132 }
6161 return NULL; 6161 return NULL;
6162 6162
6163 for (count = 0; list[count]; ++count) 6163 for (count = 0; list[count]; ++count)
6164 ; 6164 ;
6165 len = (count + 1) * sizeof(short); 6165 len = (count + 1) * sizeof(short);
6166 retval = (short *)alloc((unsigned)len); 6166 retval = (short *)alloc(len);
6167 if (retval != NULL) 6167 if (retval != NULL)
6168 mch_memmove(retval, list, (size_t)len); 6168 mch_memmove(retval, list, (size_t)len);
6169 6169
6170 return retval; 6170 return retval;
6171 } 6171 }
7165 * working, thus we should return OK. */ 7165 * working, thus we should return OK. */
7166 if (recursive) 7166 if (recursive)
7167 return OK; 7167 return OK;
7168 7168
7169 recursive = TRUE; 7169 recursive = TRUE;
7170 buf = alloc((unsigned)(STRLEN(name) + 12)); 7170 buf = alloc(STRLEN(name) + 12);
7171 if (buf != NULL) 7171 if (buf != NULL)
7172 { 7172 {
7173 apply_autocmds(EVENT_COLORSCHEMEPRE, name, 7173 apply_autocmds(EVENT_COLORSCHEMEPRE, name,
7174 curbuf->b_fname, FALSE, curbuf); 7174 curbuf->b_fname, FALSE, curbuf);
7175 sprintf((char *)buf, "colors/%s.vim", name); 7175 sprintf((char *)buf, "colors/%s.vim", name);