summaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-05-24 18:54:09 +0200
committerBram Moolenaar <Bram@vim.org>2019-05-24 18:54:09 +0200
commit964b3746b9c81e65887e2ac9a335f181db2bb592 (patch)
tree9afaaac41a1c4f71b359fd6706b88df00e22e7a1 /src/eval.c
parentd33a764123a8aedb20cd84aeff3b94810ee67c4c (diff)
patch 8.1.1384: using "int" for alloc() often results in compiler warningsv8.1.1384
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.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/eval.c b/src/eval.c
index 6950348999..4796a25bb3 100644
--- a/src/eval.c
+++ b/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/");