Mercurial > vim
comparison src/ex_eval.c @ 16825:ce04ebdf26b8 v8.1.1414
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
commit https://github.com/vim/vim/commit/c799fe206e61f2e2c1231bc46cbe4bb354f3da69
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue May 28 23:08:19 2019 +0200
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Problem: Alloc() returning "char_u *" causes a lot of type casts.
Solution: Have it return "void *". (Mike Williams) Define ALLOC_ONE() to
check the simple allocations.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 28 May 2019 23:15:10 +0200 |
parents | ef00b6bc186b |
children | 072efa9ca875 |
comparison
equal
deleted
inserted
replaced
16824:1f6bb29738d2 | 16825:ce04ebdf26b8 |
---|---|
249 { | 249 { |
250 plist = msg_list; | 250 plist = msg_list; |
251 while (*plist != NULL) | 251 while (*plist != NULL) |
252 plist = &(*plist)->next; | 252 plist = &(*plist)->next; |
253 | 253 |
254 elem = (struct msglist *)alloc(sizeof(struct msglist)); | 254 elem = ALLOC_ONE(struct msglist); |
255 if (elem == NULL) | 255 if (elem == NULL) |
256 { | 256 { |
257 suppress_errthrow = TRUE; | 257 suppress_errthrow = TRUE; |
258 emsg(_(e_outofmem)); | 258 emsg(_(e_outofmem)); |
259 } | 259 } |
517 emsg(_("E608: Cannot :throw exceptions with 'Vim' prefix")); | 517 emsg(_("E608: Cannot :throw exceptions with 'Vim' prefix")); |
518 goto fail; | 518 goto fail; |
519 } | 519 } |
520 } | 520 } |
521 | 521 |
522 excp = (except_T *)alloc(sizeof(except_T)); | 522 excp = ALLOC_ONE(except_T); |
523 if (excp == NULL) | 523 if (excp == NULL) |
524 goto nomem; | 524 goto nomem; |
525 | 525 |
526 if (type == ET_ERROR) | 526 if (type == ET_ERROR) |
527 /* Store the original message and prefix the exception value with | 527 /* Store the original message and prefix the exception value with |
1439 */ | 1439 */ |
1440 if (emsg_silent) | 1440 if (emsg_silent) |
1441 { | 1441 { |
1442 eslist_T *elem; | 1442 eslist_T *elem; |
1443 | 1443 |
1444 elem = (eslist_T *)alloc(sizeof(struct eslist_elem)); | 1444 elem = ALLOC_ONE(struct eslist_elem); |
1445 if (elem == NULL) | 1445 if (elem == NULL) |
1446 emsg(_(e_outofmem)); | 1446 emsg(_(e_outofmem)); |
1447 else | 1447 else |
1448 { | 1448 { |
1449 elem->saved_emsg_silent = emsg_silent; | 1449 elem->saved_emsg_silent = emsg_silent; |