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.
diff --git a/src/ex_getln.c b/src/ex_getln.c
index ba3dc73..00193fe 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -4154,7 +4154,7 @@
}
}
- 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 @@
{
char_u *p;
- p = alloc((unsigned)(STRLEN(*pp) + 2));
+ p = alloc(STRLEN(*pp) + 2);
if (p != NULL)
{
p[0] = '\\';
@@ -5294,7 +5294,7 @@
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 @@
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 @@
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 @@
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 @@
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);