comparison src/os_unix.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 695d9ef00b03
children 3147c7c2e86b
comparison
equal deleted inserted replaced
16824:1f6bb29738d2 16825:ce04ebdf26b8
3208 * running out of stack space. 3208 * running out of stack space.
3209 * Use of sigaltstack() is preferred, it's more portable. 3209 * Use of sigaltstack() is preferred, it's more portable.
3210 * Ignore any errors. 3210 * Ignore any errors.
3211 */ 3211 */
3212 #if defined(HAVE_SIGALTSTACK) || defined(HAVE_SIGSTACK) 3212 #if defined(HAVE_SIGALTSTACK) || defined(HAVE_SIGSTACK)
3213 signal_stack = (char *)alloc(SIGSTKSZ); 3213 signal_stack = alloc(SIGSTKSZ);
3214 init_signal_stack(); 3214 init_signal_stack();
3215 #endif 3215 #endif
3216 } 3216 }
3217 3217
3218 #if defined(EXITFREE) || defined(PROTO) 3218 #if defined(EXITFREE) || defined(PROTO)
6841 */ 6841 */
6842 vim_free(buffer); 6842 vim_free(buffer);
6843 goto notfound; 6843 goto notfound;
6844 } 6844 }
6845 *num_file = i; 6845 *num_file = i;
6846 *file = (char_u **)alloc(sizeof(char_u *) * i); 6846 *file = ALLOC_MULT(char_u *, i);
6847 if (*file == NULL) 6847 if (*file == NULL)
6848 { 6848 {
6849 /* out of memory */ 6849 /* out of memory */
6850 vim_free(buffer); 6850 vim_free(buffer);
6851 return FAIL; 6851 return FAIL;
6936 char_u ***file) 6936 char_u ***file)
6937 { 6937 {
6938 int i; 6938 int i;
6939 char_u *s; 6939 char_u *s;
6940 6940
6941 *file = (char_u **)alloc(num_pat * sizeof(char_u *)); 6941 *file = ALLOC_MULT(char_u *, num_pat);
6942 if (*file == NULL) 6942 if (*file == NULL)
6943 return FAIL; 6943 return FAIL;
6944 for (i = 0; i < num_pat; i++) 6944 for (i = 0; i < num_pat; i++)
6945 { 6945 {
6946 s = vim_strsave(pat[i]); 6946 s = vim_strsave(pat[i]);