comparison src/fileio.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 d5e1e09a829f
comparison
equal deleted inserted replaced
16824:1f6bb29738d2 16825:ce04ebdf26b8
6531 mch_free_acl(acl); 6531 mch_free_acl(acl);
6532 #endif 6532 #endif
6533 return -1; 6533 return -1;
6534 } 6534 }
6535 6535
6536 buffer = (char *)alloc(BUFSIZE); 6536 buffer = alloc(BUFSIZE);
6537 if (buffer == NULL) 6537 if (buffer == NULL)
6538 { 6538 {
6539 close(fd_out); 6539 close(fd_out);
6540 close(fd_in); 6540 close(fd_in);
6541 #ifdef HAVE_ACL 6541 #ifdef HAVE_ACL
6888 path = home_replace_save(buf, buf->b_fname); 6888 path = home_replace_save(buf, buf->b_fname);
6889 if (path != NULL) 6889 if (path != NULL)
6890 { 6890 {
6891 if (!helpmesg) 6891 if (!helpmesg)
6892 mesg2 = ""; 6892 mesg2 = "";
6893 tbuf = (char *)alloc(STRLEN(path) + STRLEN(mesg) 6893 tbuf = alloc(STRLEN(path) + STRLEN(mesg) + STRLEN(mesg2) + 2);
6894 + STRLEN(mesg2) + 2);
6895 sprintf(tbuf, mesg, path); 6894 sprintf(tbuf, mesg, path);
6896 #ifdef FEAT_EVAL 6895 #ifdef FEAT_EVAL
6897 /* Set warningmsg here, before the unimportant and output-specific 6896 /* Set warningmsg here, before the unimportant and output-specific
6898 * mesg2 has been appended. */ 6897 * mesg2 has been appended. */
6899 set_vim_var_string(VV_WARNINGMSG, (char_u *)tbuf, -1); 6898 set_vim_var_string(VV_WARNINGMSG, (char_u *)tbuf, -1);