diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-01-04 09:03:54 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-01-04 09:43:57 +0300 |
commit | 8106a6b75d45cc7472fd92f3b045697e30be8c73 (patch) | |
tree | 3b81857d4df29ce8bcc8d0043045aa6c713e4a78 /source/blender/python/mathutils/mathutils_Vector.h | |
parent | c41431f1e9e75a424717b4080434b940c2685c20 (diff) |
mathutils: refactor instantiation
remove 'type' argument, very few mathutils objects are wrapped,
add new function for creating wrapped objects.
also fixes unlikely memory leak if the data-array can't be allocated.
Diffstat (limited to 'source/blender/python/mathutils/mathutils_Vector.h')
-rw-r--r-- | source/blender/python/mathutils/mathutils_Vector.h | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/source/blender/python/mathutils/mathutils_Vector.h b/source/blender/python/mathutils/mathutils_Vector.h index 2074270670a..74ca3336f4b 100644 --- a/source/blender/python/mathutils/mathutils_Vector.h +++ b/source/blender/python/mathutils/mathutils_Vector.h @@ -34,13 +34,25 @@ extern PyTypeObject vector_Type; typedef struct { BASE_MATH_MEMBERS(vec); - int size; /* vec size 2,3 or 4 */ + int size; /* vec size 2 or more */ } VectorObject; /*prototypes*/ -PyObject *Vector_CreatePyObject(float *vec, const int size, const int type, PyTypeObject *base_type); -PyObject *Vector_CreatePyObject_cb(PyObject *user, int size, - unsigned char cb_type, unsigned char subtype); -PyObject *Vector_CreatePyObject_alloc(const float *vec, const int size, PyTypeObject *base_type); +PyObject *Vector_CreatePyObject( + const float *vec, const int size, + PyTypeObject *base_type + ) ATTR_WARN_UNUSED_RESULT; +PyObject *Vector_CreatePyObject_wrap( + float *vec, const int size, + PyTypeObject *base_type + ) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); +PyObject *Vector_CreatePyObject_cb( + PyObject *user, int size, + unsigned char cb_type, unsigned char subtype + ) ATTR_WARN_UNUSED_RESULT; +PyObject *Vector_CreatePyObject_alloc( + float *vec, const int size, + PyTypeObject *base_type + ) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); #endif /* __MATHUTILS_VECTOR_H__ */ |