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/memfile.c b/src/memfile.c
index 1827bcf..9a1b4cb 100644
--- a/src/memfile.c
+++ b/src/memfile.c
@@ -130,7 +130,7 @@
struct STATFS stf;
#endif
- if ((mfp = (memfile_T *)alloc((unsigned)sizeof(memfile_T))) == NULL)
+ if ((mfp = (memfile_T *)alloc(sizeof(memfile_T))) == NULL)
return NULL;
if (fname == NULL) /* no file for this memfile, use memory only */
@@ -893,7 +893,7 @@
{
bhdr_T *hp;
- if ((hp = (bhdr_T *)alloc((unsigned)sizeof(bhdr_T))) != NULL)
+ if ((hp = (bhdr_T *)alloc(sizeof(bhdr_T))) != NULL)
{
if ((hp->bh_data = (char_u *)alloc(mfp->mf_page_size * page_count))
== NULL)
@@ -1108,7 +1108,7 @@
if (hp->bh_bnum >= 0) /* it's already positive */
return OK;
- if ((np = (NR_TRANS *)alloc((unsigned)sizeof(NR_TRANS))) == NULL)
+ if ((np = (NR_TRANS *)alloc(sizeof(NR_TRANS))) == NULL)
return FAIL;
/*