From bf0c8e116db49379900020b5a20ba15d91b3fb9a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 6 Jan 2015 17:39:47 +1100 Subject: PyAPI: add PyList_APPEND This appends while giving ownership to the list, avoiding temp assignment. This matches PyList_SET_ITEM which bypasses refcount's Note, this also reduce code-size, Py_DECREF is a rather heavy macro. --- source/blender/python/intern/bpy.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'source/blender/python/intern/bpy.c') diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c index dbeccfdb8e6..ec3c017a7ed 100644 --- a/source/blender/python/intern/bpy.c +++ b/source/blender/python/intern/bpy.c @@ -51,6 +51,7 @@ #include "bpy_utils_units.h" #include "../generic/py_capi_utils.h" +#include "../generic/python_utildefines.h" /* external util modules */ #include "../generic/idprop_py_api.h" @@ -89,10 +90,7 @@ static PyObject *bpy_script_paths(PyObject *UNUSED(self)) static bool bpy_blend_paths_visit_cb(void *userdata, char *UNUSED(path_dst), const char *path_src) { - PyObject *list = (PyObject *)userdata; - PyObject *item = PyC_UnicodeFromByte(path_src); - PyList_Append(list, item); - Py_DECREF(item); + PyList_APPEND((PyObject *)userdata, PyC_UnicodeFromByte(path_src)); return false; /* never edits the path */ } -- cgit v1.2.3