Cleanup: style, use braces for the Python API
This commit is contained in:
@@ -105,15 +105,17 @@ Py_hash_t mathutils_array_hash(const float *array, size_t array_len)
|
||||
i = 0;
|
||||
while (--len >= 0) {
|
||||
y = _Py_HashDouble((double)(array[i++]));
|
||||
if (y == -1)
|
||||
if (y == -1) {
|
||||
return -1;
|
||||
}
|
||||
x = (x ^ y) * mult;
|
||||
/* the cast might truncate len; that doesn't change hash stability */
|
||||
mult += (Py_hash_t)(82520UL + len + len);
|
||||
}
|
||||
x += 97531UL;
|
||||
if (x == (Py_uhash_t)-1)
|
||||
if (x == (Py_uhash_t)-1) {
|
||||
x = -2;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
@@ -392,8 +394,9 @@ int EXPP_VectorsAreEqual(const float *vecA, const float *vecB, int size, int flo
|
||||
{
|
||||
int x;
|
||||
for (x = 0; x < size; x++) {
|
||||
if (EXPP_FloatsAreEqual(vecA[x], vecB[x], floatSteps) == 0)
|
||||
if (EXPP_FloatsAreEqual(vecA[x], vecB[x], floatSteps) == 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -425,8 +428,10 @@ unsigned char Mathutils_RegisterCallback(Mathutils_Callback *cb)
|
||||
|
||||
/* find the first free slot */
|
||||
for (i = 0; mathutils_callbacks[i]; i++) {
|
||||
if (mathutils_callbacks[i] == cb) /* already registered? */
|
||||
if (mathutils_callbacks[i] == cb) {
|
||||
/* already registered? */
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
BLI_assert(i + 1 < MATHUTILS_TOT_CB);
|
||||
@@ -611,18 +616,24 @@ PyMODINIT_FUNC PyInit_mathutils(void)
|
||||
PyObject *submodule;
|
||||
PyObject *sys_modules = PyImport_GetModuleDict();
|
||||
|
||||
if (PyType_Ready(&vector_Type) < 0)
|
||||
if (PyType_Ready(&vector_Type) < 0) {
|
||||
return NULL;
|
||||
if (PyType_Ready(&matrix_Type) < 0)
|
||||
}
|
||||
if (PyType_Ready(&matrix_Type) < 0) {
|
||||
return NULL;
|
||||
if (PyType_Ready(&matrix_access_Type) < 0)
|
||||
}
|
||||
if (PyType_Ready(&matrix_access_Type) < 0) {
|
||||
return NULL;
|
||||
if (PyType_Ready(&euler_Type) < 0)
|
||||
}
|
||||
if (PyType_Ready(&euler_Type) < 0) {
|
||||
return NULL;
|
||||
if (PyType_Ready(&quaternion_Type) < 0)
|
||||
}
|
||||
if (PyType_Ready(&quaternion_Type) < 0) {
|
||||
return NULL;
|
||||
if (PyType_Ready(&color_Type) < 0)
|
||||
}
|
||||
if (PyType_Ready(&color_Type) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mod = PyModule_Create(&M_Mathutils_module_def);
|
||||
|
||||
|
Reference in New Issue
Block a user