Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
16763:fccf84413b53 | 16764:ef00b6bc186b |
---|---|
128 #if defined(STATFS) && defined(UNIX) && !defined(__QNX__) && !defined(__minix) | 128 #if defined(STATFS) && defined(UNIX) && !defined(__QNX__) && !defined(__minix) |
129 # define USE_FSTATFS | 129 # define USE_FSTATFS |
130 struct STATFS stf; | 130 struct STATFS stf; |
131 #endif | 131 #endif |
132 | 132 |
133 if ((mfp = (memfile_T *)alloc((unsigned)sizeof(memfile_T))) == NULL) | 133 if ((mfp = (memfile_T *)alloc(sizeof(memfile_T))) == NULL) |
134 return NULL; | 134 return NULL; |
135 | 135 |
136 if (fname == NULL) /* no file for this memfile, use memory only */ | 136 if (fname == NULL) /* no file for this memfile, use memory only */ |
137 { | 137 { |
138 mfp->mf_fname = NULL; | 138 mfp->mf_fname = NULL; |
891 static bhdr_T * | 891 static bhdr_T * |
892 mf_alloc_bhdr(memfile_T *mfp, int page_count) | 892 mf_alloc_bhdr(memfile_T *mfp, int page_count) |
893 { | 893 { |
894 bhdr_T *hp; | 894 bhdr_T *hp; |
895 | 895 |
896 if ((hp = (bhdr_T *)alloc((unsigned)sizeof(bhdr_T))) != NULL) | 896 if ((hp = (bhdr_T *)alloc(sizeof(bhdr_T))) != NULL) |
897 { | 897 { |
898 if ((hp->bh_data = (char_u *)alloc(mfp->mf_page_size * page_count)) | 898 if ((hp->bh_data = (char_u *)alloc(mfp->mf_page_size * page_count)) |
899 == NULL) | 899 == NULL) |
900 { | 900 { |
901 vim_free(hp); /* not enough memory */ | 901 vim_free(hp); /* not enough memory */ |
1106 int page_count; | 1106 int page_count; |
1107 | 1107 |
1108 if (hp->bh_bnum >= 0) /* it's already positive */ | 1108 if (hp->bh_bnum >= 0) /* it's already positive */ |
1109 return OK; | 1109 return OK; |
1110 | 1110 |
1111 if ((np = (NR_TRANS *)alloc((unsigned)sizeof(NR_TRANS))) == NULL) | 1111 if ((np = (NR_TRANS *)alloc(sizeof(NR_TRANS))) == NULL) |
1112 return FAIL; | 1112 return FAIL; |
1113 | 1113 |
1114 /* | 1114 /* |
1115 * Get a new number for the block. | 1115 * Get a new number for the block. |
1116 * If the first item in the free list has sufficient pages, use its number | 1116 * If the first item in the free list has sufficient pages, use its number |