mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
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.
This commit is contained in:
16
src/option.c
16
src/option.c
@@ -3430,7 +3430,7 @@ set_init_1(int clean_arg)
|
||||
cdpath = vim_getenv((char_u *)"CDPATH", &mustfree);
|
||||
if (cdpath != NULL)
|
||||
{
|
||||
buf = alloc((unsigned)((STRLEN(cdpath) << 1) + 2));
|
||||
buf = alloc((STRLEN(cdpath) << 1) + 2);
|
||||
if (buf != NULL)
|
||||
{
|
||||
buf[0] = ','; /* start with ",", current dir first */
|
||||
@@ -7913,7 +7913,7 @@ skip:
|
||||
wp->w_p_cc_cols = NULL;
|
||||
else
|
||||
{
|
||||
wp->w_p_cc_cols = (int *)alloc((unsigned)sizeof(int) * (count + 1));
|
||||
wp->w_p_cc_cols = (int *)alloc(sizeof(int) * (count + 1));
|
||||
if (wp->w_p_cc_cols != NULL)
|
||||
{
|
||||
/* sort the columns for faster usage on screen redraw inside
|
||||
@@ -10053,8 +10053,8 @@ showoptions(
|
||||
#define INC 20
|
||||
#define GAP 3
|
||||
|
||||
items = (struct vimoption **)alloc((unsigned)(sizeof(struct vimoption *) *
|
||||
PARAM_COUNT));
|
||||
items = (struct vimoption **)alloc(sizeof(struct vimoption *)
|
||||
* PARAM_COUNT);
|
||||
if (items == NULL)
|
||||
return;
|
||||
|
||||
@@ -11941,7 +11941,7 @@ ExpandSettings(
|
||||
*num_file = num_term;
|
||||
else
|
||||
return OK;
|
||||
*file = (char_u **)alloc((unsigned)(*num_file * sizeof(char_u *)));
|
||||
*file = (char_u **)alloc(*num_file * sizeof(char_u *));
|
||||
if (*file == NULL)
|
||||
{
|
||||
*file = (char_u **)"";
|
||||
@@ -11959,7 +11959,7 @@ ExpandOldSetting(int *num_file, char_u ***file)
|
||||
char_u *buf;
|
||||
|
||||
*num_file = 0;
|
||||
*file = (char_u **)alloc((unsigned)sizeof(char_u *));
|
||||
*file = (char_u **)alloc(sizeof(char_u *));
|
||||
if (*file == NULL)
|
||||
return FAIL;
|
||||
|
||||
@@ -12822,7 +12822,7 @@ tabstop_set(char_u *var, int **array)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*array = (int *)alloc((unsigned) ((valcount + 1) * sizeof(int)));
|
||||
*array = (int *)alloc((valcount + 1) * sizeof(int));
|
||||
if (*array == NULL)
|
||||
return FALSE;
|
||||
(*array)[0] = valcount;
|
||||
@@ -13045,7 +13045,7 @@ tabstop_copy(int *oldts)
|
||||
|
||||
if (oldts == NULL)
|
||||
return NULL;
|
||||
newts = (int *)alloc((unsigned)((oldts[0] + 1) * sizeof(int)));
|
||||
newts = (int *)alloc((oldts[0] + 1) * sizeof(int));
|
||||
if (newts != NULL)
|
||||
for (t = 0; t <= oldts[0]; ++t)
|
||||
newts[t] = oldts[t];
|
||||
|
Reference in New Issue
Block a user