Mercurial > vim
comparison src/dict.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 | 54ffc82f38a8 |
children | fc58fee685e2 |
comparison
equal
deleted
inserted
replaced
16763:fccf84413b53 | 16764:ef00b6bc186b |
---|---|
208 dictitem_T * | 208 dictitem_T * |
209 dictitem_alloc(char_u *key) | 209 dictitem_alloc(char_u *key) |
210 { | 210 { |
211 dictitem_T *di; | 211 dictitem_T *di; |
212 | 212 |
213 di = (dictitem_T *)alloc((unsigned)(sizeof(dictitem_T) + STRLEN(key))); | 213 di = (dictitem_T *)alloc(sizeof(dictitem_T) + STRLEN(key)); |
214 if (di != NULL) | 214 if (di != NULL) |
215 { | 215 { |
216 STRCPY(di->di_key, key); | 216 STRCPY(di->di_key, key); |
217 di->di_flags = DI_FLAGS_ALLOC; | 217 di->di_flags = DI_FLAGS_ALLOC; |
218 di->di_tv.v_lock = 0; | 218 di->di_tv.v_lock = 0; |
226 static dictitem_T * | 226 static dictitem_T * |
227 dictitem_copy(dictitem_T *org) | 227 dictitem_copy(dictitem_T *org) |
228 { | 228 { |
229 dictitem_T *di; | 229 dictitem_T *di; |
230 | 230 |
231 di = (dictitem_T *)alloc((unsigned)(sizeof(dictitem_T) | 231 di = (dictitem_T *)alloc(sizeof(dictitem_T) + STRLEN(org->di_key)); |
232 + STRLEN(org->di_key))); | |
233 if (di != NULL) | 232 if (di != NULL) |
234 { | 233 { |
235 STRCPY(di->di_key, org->di_key); | 234 STRCPY(di->di_key, org->di_key); |
236 di->di_flags = DI_FLAGS_ALLOC; | 235 di->di_flags = DI_FLAGS_ALLOC; |
237 copy_tv(&org->di_tv, &di->di_tv); | 236 copy_tv(&org->di_tv, &di->di_tv); |