0
0
mirror of https://github.com/vim/vim.git synced 2025-10-01 04:54:07 -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:
Bram Moolenaar
2019-05-24 18:54:09 +02:00
parent d33a764123
commit 964b3746b9
63 changed files with 293 additions and 322 deletions

View File

@@ -5094,7 +5094,7 @@ repl_cmdline(
i = (int)(src - *cmdlinep) + (int)STRLEN(src + srclen) + len + 3;
if (eap->nextcmd != NULL)
i += (int)STRLEN(eap->nextcmd);/* add space for next command */
if ((new_cmdline = alloc((unsigned)i)) == NULL)
if ((new_cmdline = alloc(i)) == NULL)
return NULL; /* out of memory! */
/*
@@ -6547,7 +6547,7 @@ alist_unlink(alist_T *al)
void
alist_new(void)
{
curwin->w_alist = (alist_T *)alloc((unsigned)sizeof(alist_T));
curwin->w_alist = (alist_T *)alloc(sizeof(alist_T));
if (curwin->w_alist == NULL)
{
curwin->w_alist = &global_alist;
@@ -6581,7 +6581,7 @@ alist_expand(int *fnum_list, int fnum_len)
* expansion. Also, the vimrc file isn't read yet, thus the user
* can't set the options. */
p_su = empty_option;
old_arg_files = (char_u **)alloc((unsigned)(sizeof(char_u *) * GARGCOUNT));
old_arg_files = (char_u **)alloc(sizeof(char_u *) * GARGCOUNT);
if (old_arg_files != NULL)
{
for (i = 0; i < GARGCOUNT; ++i)
@@ -8839,7 +8839,7 @@ ex_normal(exarg_T *eap)
}
if (len > 0)
{
arg = alloc((unsigned)(STRLEN(eap->arg) + len + 1));
arg = alloc(STRLEN(eap->arg) + len + 1);
if (arg != NULL)
{
len = 0;
@@ -9628,7 +9628,7 @@ arg_all(void)
}
/* allocate memory */
retval = alloc((unsigned)len + 1);
retval = alloc(len + 1);
if (retval == NULL)
break;
}
@@ -10622,7 +10622,7 @@ get_view_file(int c)
for (p = sname; *p; ++p)
if (*p == '=' || vim_ispathsep(*p))
++len;
retval = alloc((unsigned)(STRLEN(sname) + len + STRLEN(p_vdir) + 9));
retval = alloc(STRLEN(sname) + len + STRLEN(p_vdir) + 9);
if (retval != NULL)
{
STRCPY(retval, p_vdir);