diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-05-28 23:08:19 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-05-28 23:08:19 +0200 |
commit | c799fe206e61f2e2c1231bc46cbe4bb354f3da69 (patch) | |
tree | 68b3d2a8bb82519e29fc95f317d2ee02b07f95fa /src/gui_gtk_x11.c | |
parent | b58a4b938c4bc7e0499700859bd7abba9acc5b11 (diff) | |
download | vim-git-c799fe206e61f2e2c1231bc46cbe4bb354f3da69.tar.gz |
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type castsv8.1.1414
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.
Diffstat (limited to 'src/gui_gtk_x11.c')
-rw-r--r-- | src/gui_gtk_x11.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c index 17ef6eabd..a994869a5 100644 --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -429,7 +429,7 @@ gui_mch_prepare(int *argc, char **argv) * into gui_argv. Freed later in gui_mch_init(). */ gui_argc = 0; - gui_argv = (char **)alloc((*argc + 1) * sizeof(char *)); + gui_argv = ALLOC_MULT(char *, *argc + 1); g_return_if_fail(gui_argv != NULL); @@ -2157,10 +2157,10 @@ parse_uri_list(int *count, char_u *data, int len) char_u *tmp = NULL; char_u **array = NULL; - if (data != NULL && len > 0 && (tmp = (char_u *)alloc(len + 1)) != NULL) + if (data != NULL && len > 0 && (tmp = alloc(len + 1)) != NULL) { n = count_and_decode_uri_list(tmp, data, len); - if (n > 0 && (array = (char_u **)alloc(n * sizeof(char_u *))) != NULL) + if (n > 0 && (array = ALLOC_MULT(char_u *, n)) != NULL) n = filter_uri_list(array, n, tmp); } vim_free(tmp); @@ -2512,7 +2512,7 @@ setup_save_yourself(void) if (i == count) { /* allocate an Atoms array which is one item longer */ - new_atoms = (Atom *)alloc((count + 1) * sizeof(Atom)); + new_atoms = ALLOC_MULT(Atom, count + 1); if (new_atoms != NULL) { memcpy(new_atoms, existing_atoms, count * sizeof(Atom)); |