summaryrefslogtreecommitdiff
path: root/src/if_mzsch.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-05-28 23:08:19 +0200
committerBram Moolenaar <Bram@vim.org>2019-05-28 23:08:19 +0200
commitc799fe206e61f2e2c1231bc46cbe4bb354f3da69 (patch)
tree68b3d2a8bb82519e29fc95f317d2ee02b07f95fa /src/if_mzsch.c
parentb58a4b938c4bc7e0499700859bd7abba9acc5b11 (diff)
downloadvim-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/if_mzsch.c')
-rw-r--r--src/if_mzsch.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/if_mzsch.c b/src/if_mzsch.c
index f648e7407..04a444e23 100644
--- a/src/if_mzsch.c
+++ b/src/if_mzsch.c
@@ -2582,7 +2582,7 @@ set_buffer_line_list(void *data, int argc, Scheme_Object **argv)
MZ_GC_VAR_IN_REG(1, rest);
MZ_GC_REG();
- array = (char **)alloc((new_len+1)* sizeof(char *));
+ array = ALLOC_MULT(char *, new_len + 1);
vim_memset(array, 0, (new_len+1) * sizeof(char *));
rest = line_list;
@@ -2766,7 +2766,7 @@ insert_buffer_line_list(void *data, int argc, Scheme_Object **argv)
MZ_GC_VAR_IN_REG(1, rest);
MZ_GC_REG();
- array = (char **)alloc((size+1) * sizeof(char *));
+ array = ALLOC_MULT(char *, size + 1);
vim_memset(array, 0, (size+1) * sizeof(char *));
rest = list;
@@ -2886,7 +2886,7 @@ string_to_line(Scheme_Object *obj)
if (memchr(scheme_str, '\n', len))
scheme_signal_error(_("string cannot contain newlines"));
- vim_str = (char *)alloc(len + 1);
+ vim_str = alloc(len + 1);
/* Create a copy of the string, with internal nulls replaced by
* newline characters, as is the vim convention.
@@ -3213,14 +3213,14 @@ mzscheme_to_vim_impl(Scheme_Object *obj, typval_T *tv, int depth,
tv->vval.v_list = list;
++list->lv_refcount;
- v = (typval_T *)alloc(sizeof(typval_T));
+ v = ALLOC_ONE(typval_T);
if (v == NULL)
status = FAIL;
else
{
/* add the value in advance to allow handling of self-referential
* data structures */
- typval_T *visited_tv = (typval_T *)alloc(sizeof(typval_T));
+ typval_T *visited_tv = ALLOC_ONE(typval_T);
copy_tv(tv, visited_tv);
scheme_hash_set(visited, obj, (Scheme_Object *)visited_tv);
@@ -3288,7 +3288,7 @@ mzscheme_to_vim_impl(Scheme_Object *obj, typval_T *tv, int depth,
status = FAIL;
else
{
- typval_T *visited_tv = (typval_T *)alloc(sizeof(typval_T));
+ typval_T *visited_tv = ALLOC_ONE(typval_T);
tv->v_type = VAR_DICT;
tv->vval.v_dict = dict;
@@ -3353,7 +3353,7 @@ vim_funcref(void *name, int argc, Scheme_Object **argv)
++list->lv_refcount;
for (i = 0; status == OK && i < argc; ++i)
{
- typval_T *v = (typval_T *)alloc(sizeof(typval_T));
+ typval_T *v = ALLOC_ONE(typval_T);
if (v == NULL)
status = FAIL;
else