0
0
mirror of https://github.com/vim/vim.git synced 2025-10-11 06:34:16 -04:00

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.
This commit is contained in:
Bram Moolenaar
2019-05-28 23:08:19 +02:00
parent b58a4b938c
commit c799fe206e
77 changed files with 381 additions and 418 deletions

View File

@@ -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