diff src/if_py_both.h @ 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 1d30eb64a7a2
line wrap: on
line diff
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -3138,8 +3138,7 @@ set_partial(FunctionObject *self, partia
 	pt->pt_argc = self->argc;
 	if (exported)
 	{
-	    pt->pt_argv = (typval_T *)alloc_clear(
-						sizeof(typval_T) * self->argc);
+	    pt->pt_argv = ALLOC_CLEAR_MULT(typval_T, self->argc);
 	    for (i = 0; i < pt->pt_argc; ++i)
 		copy_tv(&self->argv[i], &pt->pt_argv[i]);
 	}
@@ -4262,7 +4261,7 @@ StringToLine(PyObject *obj)
     /* Create a copy of the string, with internal nulls replaced by
      * newline characters, as is the vim convention.
      */
-    save = (char *)alloc(len+1);
+    save = alloc(len+1);
     if (save == NULL)
     {
 	PyErr_NoMemory();
@@ -6243,7 +6242,8 @@ ConvertFromPyObject(PyObject *obj, typva
 	FunctionObject *func = (FunctionObject *) obj;
 	if (func->self != NULL || func->argv != NULL)
 	{
-	    partial_T *pt = (partial_T *)alloc_clear(sizeof(partial_T));
+	    partial_T *pt = ALLOC_CLEAR_ONE(partial_T);
+
 	    set_partial(func, pt, TRUE);
 	    tv->vval.v_partial = pt;
 	    tv->v_type = VAR_PARTIAL;