Cleanup: use the naming convention in py_capi_utils

And use inline functions instead of preprocessor directives.
This commit is contained in:
2018-10-06 01:15:15 -03:00
parent 0f55334413
commit 495a7128cb
3 changed files with 75 additions and 17 deletions

View File

@@ -91,17 +91,11 @@ static PyObject *bpygpu_IndexBuf_new(PyTypeObject *UNUSED(type), PyObject *args,
return NULL;
}
bool format_error = pybuffer.itemsize != 4;
if (pybuffer.itemsize != 4 ||
PyC_Formatstr_is_float(PyC_Formatstr_get(pybuffer.format)))
{
char format = FORMAT_STR_GET(pybuffer.format);
if (FORMAT_STR_IS_FLOAT(format)) {
format_error = true;
}
}
if (format_error) {
PyErr_Format(PyExc_ValueError,
"Each index must be an integer value with 4 bytes in size");
"Each index must be an 4-bytes integer value");
return NULL;
}