0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -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

@@ -4154,7 +4154,7 @@ ExpandOne(
}
}
ss = alloc((unsigned)len + 1);
ss = alloc(len + 1);
if (ss)
vim_strncpy(ss, xp->xp_files[0], (size_t)len);
findex = -1; /* next p_wc gets first one */
@@ -4362,7 +4362,7 @@ escape_fname(char_u **pp)
{
char_u *p;
p = alloc((unsigned)(STRLEN(*pp) + 2));
p = alloc(STRLEN(*pp) + 2);
if (p != NULL)
{
p[0] = '\\';
@@ -5294,7 +5294,7 @@ ExpandGeneric(
if (count == 0)
return OK;
*num_file = count;
*file = (char_u **)alloc((unsigned)(count * sizeof(char_u *)));
*file = (char_u **)alloc(count * sizeof(char_u *));
if (*file == NULL)
{
*file = (char_u **)"";
@@ -5636,7 +5636,7 @@ ExpandRTDir(
for (i = 0; dirnames[i] != NULL; ++i)
{
s = alloc((unsigned)(STRLEN(dirnames[i]) + pat_len + 7));
s = alloc(STRLEN(dirnames[i]) + pat_len + 7);
if (s == NULL)
{
ga_clear_strings(&ga);
@@ -5650,7 +5650,7 @@ ExpandRTDir(
if (flags & DIP_START) {
for (i = 0; dirnames[i] != NULL; ++i)
{
s = alloc((unsigned)(STRLEN(dirnames[i]) + pat_len + 22));
s = alloc(STRLEN(dirnames[i]) + pat_len + 22);
if (s == NULL)
{
ga_clear_strings(&ga);
@@ -5665,7 +5665,7 @@ ExpandRTDir(
if (flags & DIP_OPT) {
for (i = 0; dirnames[i] != NULL; ++i)
{
s = alloc((unsigned)(STRLEN(dirnames[i]) + pat_len + 20));
s = alloc(STRLEN(dirnames[i]) + pat_len + 20);
if (s == NULL)
{
ga_clear_strings(&ga);
@@ -5728,7 +5728,7 @@ ExpandPackAddDir(
pat_len = (int)STRLEN(pat);
ga_init2(&ga, (int)sizeof(char *), 10);
s = alloc((unsigned)(pat_len + 26));
s = alloc(pat_len + 26);
if (s == NULL)
{
ga_clear_strings(&ga);