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/userfunc.c b/src/userfunc.c
index 763903f..dcf8034 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -557,7 +557,7 @@
}
else
{
- fname = alloc((unsigned)(i + STRLEN(name + llen) + 1));
+ fname = alloc(i + STRLEN(name + llen) + 1);
if (fname == NULL)
*error = ERROR_OTHER;
else
@@ -978,7 +978,7 @@
/* need space for function name + ("function " + 3) or "[number]" */
len = (save_sourcing_name == NULL ? 0 : STRLEN(save_sourcing_name))
+ STRLEN(fp->uf_name) + 20;
- sourcing_name = alloc((unsigned)len);
+ sourcing_name = alloc(len);
if (sourcing_name != NULL)
{
if (save_sourcing_name != NULL
@@ -1932,7 +1932,7 @@
}
}
- name = alloc((unsigned)(len + lead + 1));
+ name = alloc(len + lead + 1);
if (name != NULL)
{
if (lead > 0)
@@ -2787,7 +2787,7 @@
if (todo == 0)
return; /* nothing to dump */
- sorttab = (ufunc_T **)alloc((unsigned)(sizeof(ufunc_T *) * todo));
+ sorttab = (ufunc_T **)alloc(sizeof(ufunc_T *) * todo);
for (hi = func_hashtab.ht_array; todo > 0; ++hi)
{