diff options
Diffstat (limited to 'source/blender/python/mathutils/mathutils.c')
-rw-r--r-- | source/blender/python/mathutils/mathutils.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c index 2aabcaee04c..ff551206fae 100644 --- a/source/blender/python/mathutils/mathutils.c +++ b/source/blender/python/mathutils/mathutils.c @@ -284,18 +284,21 @@ PyObject *mathutils_dynstr_to_py(struct DynStr *ds) /* Mathutils Callbacks */ /* for mathutils internal use only, eventually should re-alloc but to start with we only have a few users */ -static Mathutils_Callback *mathutils_callbacks[8] = {NULL}; +#define MATHUTILS_TOT_CB 8 +static Mathutils_Callback *mathutils_callbacks[MATHUTILS_TOT_CB] = {NULL}; -int Mathutils_RegisterCallback(Mathutils_Callback *cb) +unsigned char Mathutils_RegisterCallback(Mathutils_Callback *cb) { - int i; + unsigned char i; /* find the first free slot */ for (i = 0; mathutils_callbacks[i]; i++) { if (mathutils_callbacks[i] == cb) /* already registered? */ return i; } - + + BLI_assert(i < MATHUTILS_TOT_CB); + mathutils_callbacks[i] = cb; return i; } |