mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -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:
15
src/eval.c
15
src/eval.c
@@ -5151,7 +5151,7 @@ get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
|
||||
* Copy the string into allocated memory, handling backslashed
|
||||
* characters.
|
||||
*/
|
||||
name = alloc((unsigned)(p - *arg + extra));
|
||||
name = alloc(p - *arg + extra);
|
||||
if (name == NULL)
|
||||
return FAIL;
|
||||
rettv->v_type = VAR_STRING;
|
||||
@@ -5285,7 +5285,7 @@ get_lit_string_tv(char_u **arg, typval_T *rettv, int evaluate)
|
||||
/*
|
||||
* Copy the string into allocated memory, handling '' to ' reduction.
|
||||
*/
|
||||
str = alloc((unsigned)((p - *arg) - reduce));
|
||||
str = alloc((p - *arg) - reduce);
|
||||
if (str == NULL)
|
||||
return FAIL;
|
||||
rettv->v_type = VAR_STRING;
|
||||
@@ -6782,8 +6782,8 @@ make_expanded_name(
|
||||
temp_result = eval_to_string(expr_start + 1, &nextcmd, FALSE);
|
||||
if (temp_result != NULL && nextcmd == NULL)
|
||||
{
|
||||
retval = alloc((unsigned)(STRLEN(temp_result) + (expr_start - in_start)
|
||||
+ (in_end - expr_end) + 1));
|
||||
retval = alloc(STRLEN(temp_result) + (expr_start - in_start)
|
||||
+ (in_end - expr_end) + 1);
|
||||
if (retval != NULL)
|
||||
{
|
||||
STRCPY(retval, in_start);
|
||||
@@ -8130,8 +8130,7 @@ set_var(
|
||||
if (!valid_varname(varname))
|
||||
return;
|
||||
|
||||
v = (dictitem_T *)alloc((unsigned)(sizeof(dictitem_T)
|
||||
+ STRLEN(varname)));
|
||||
v = (dictitem_T *)alloc(sizeof(dictitem_T) + STRLEN(varname));
|
||||
if (v == NULL)
|
||||
return;
|
||||
STRCPY(v->di_key, varname);
|
||||
@@ -8993,7 +8992,7 @@ setwinvar(typval_T *argvars, typval_T *rettv UNUSED, int off)
|
||||
}
|
||||
else
|
||||
{
|
||||
winvarname = alloc((unsigned)STRLEN(varname) + 3);
|
||||
winvarname = alloc(STRLEN(varname) + 3);
|
||||
if (winvarname != NULL)
|
||||
{
|
||||
STRCPY(winvarname, "w:");
|
||||
@@ -9056,7 +9055,7 @@ autoload_name(char_u *name)
|
||||
char_u *scriptname;
|
||||
|
||||
/* Get the script file name: replace '#' with '/', append ".vim". */
|
||||
scriptname = alloc((unsigned)(STRLEN(name) + 14));
|
||||
scriptname = alloc(STRLEN(name) + 14);
|
||||
if (scriptname == NULL)
|
||||
return FALSE;
|
||||
STRCPY(scriptname, "autoload/");
|
||||
|
Reference in New Issue
Block a user