Mercurial > vim
diff src/memfile.c @ 16764:ef00b6bc186b v8.1.1384
patch 8.1.1384: using "int" for alloc() often results in compiler warnings
commit https://github.com/vim/vim/commit/964b3746b9c81e65887e2ac9a335f181db2bb592
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri May 24 18:54:09 2019 +0200
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 24 May 2019 19:00:07 +0200 |
parents | 7fad90423bd2 |
children | b1b7c7a31679 |
line wrap: on
line diff
--- a/src/memfile.c +++ b/src/memfile.c @@ -130,7 +130,7 @@ mf_open(char_u *fname, int flags) 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 @@ mf_alloc_bhdr(memfile_T *mfp, int page_c { 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 @@ mf_trans_add(memfile_T *mfp, bhdr_T *hp) 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; /*