Mercurial > vim
comparison src/ex_docmd.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 | fc58fee685e2 |
children | da5f5836e90c |
comparison
equal
deleted
inserted
replaced
16824:1f6bb29738d2 | 16825:ce04ebdf26b8 |
---|---|
6548 * Create a new argument list and use it for the current window. | 6548 * Create a new argument list and use it for the current window. |
6549 */ | 6549 */ |
6550 void | 6550 void |
6551 alist_new(void) | 6551 alist_new(void) |
6552 { | 6552 { |
6553 curwin->w_alist = (alist_T *)alloc(sizeof(alist_T)); | 6553 curwin->w_alist = ALLOC_ONE(alist_T); |
6554 if (curwin->w_alist == NULL) | 6554 if (curwin->w_alist == NULL) |
6555 { | 6555 { |
6556 curwin->w_alist = &global_alist; | 6556 curwin->w_alist = &global_alist; |
6557 ++global_alist.al_refcount; | 6557 ++global_alist.al_refcount; |
6558 } | 6558 } |
6582 | 6582 |
6583 /* Don't use 'suffixes' here. This should work like the shell did the | 6583 /* Don't use 'suffixes' here. This should work like the shell did the |
6584 * expansion. Also, the vimrc file isn't read yet, thus the user | 6584 * expansion. Also, the vimrc file isn't read yet, thus the user |
6585 * can't set the options. */ | 6585 * can't set the options. */ |
6586 p_su = empty_option; | 6586 p_su = empty_option; |
6587 old_arg_files = (char_u **)alloc(sizeof(char_u *) * GARGCOUNT); | 6587 old_arg_files = ALLOC_MULT(char_u *, GARGCOUNT); |
6588 if (old_arg_files != NULL) | 6588 if (old_arg_files != NULL) |
6589 { | 6589 { |
6590 for (i = 0; i < GARGCOUNT; ++i) | 6590 for (i = 0; i < GARGCOUNT; ++i) |
6591 old_arg_files[i] = vim_strsave(GARGLIST[i].ae_fname); | 6591 old_arg_files[i] = vim_strsave(GARGLIST[i].ae_fname); |
6592 old_arg_count = GARGCOUNT; | 6592 old_arg_count = GARGCOUNT; |