diff options
author | mano-wii <germano.costa@ig.com.br> | 2018-10-07 18:22:17 +0300 |
---|---|---|
committer | mano-wii <germano.costa@ig.com.br> | 2018-10-07 18:22:17 +0300 |
commit | af7967b010d3dff6ecdece7e5fd1932d1cd0c23d (patch) | |
tree | 6986a6681606daa0c2d9a9f8060b300d91032dbe | |
parent | 91bfea5b052a6276654eb4f71c71707cda3d4305 (diff) |
CPython: py_capi_utils: format char utilities do not need to be inline.
-rw-r--r-- | source/blender/python/generic/py_capi_utils.c | 78 | ||||
-rw-r--r-- | source/blender/python/generic/py_capi_utils.h | 74 |
2 files changed, 83 insertions, 69 deletions
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index 62b24618d3f..047ff9807a6 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -1327,6 +1327,84 @@ uint32_t PyC_Long_AsU32(PyObject *value) * PyC_Long_AsU64 */ +/* -------------------------------------------------------------------- */ + +/** \name Py_buffer Utils + * + * \{ */ + +char PyC_Formatchar_get(const char *typestr) +{ + switch (typestr[0]) { + case '!': + case '<': + case '=': + case '>': + case '@': + return typestr[1]; + default: + return typestr[0]; + } +} + +bool PyC_Formatchar_is_floating_type(char format) +{ + switch (format) { + case 'f': + case 'd': + case 'e': + return true; + default: + return false; + } +} + +bool PyC_Formatchar_is_integer_type(char format) +{ + switch (format) { + case 'i': + case 'I': + case 'l': + case 'L': + case 'h': + case 'H': + case 'b': + case 'B': + case 'q': + case 'Q': + case 'n': + case 'N': + case 'P': + return true; + default: + return false; + } +} + +bool PyC_Formatchar_is_byte_type(char format) +{ + switch (format) { + case 'c': + case 's': + case 'p': + return true; + default: + return false; + } +} + +bool PyC_Formatchar_is_boolean_type(char format) +{ + switch (format) { + case '?': + return true; + default: + return false; + } +} + +/** \} */ + #ifdef __GNUC__ # pragma warning(pop) #endif diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h index 5ff070d3b75..7631dc3f3a6 100644 --- a/source/blender/python/generic/py_capi_utils.h +++ b/source/blender/python/generic/py_capi_utils.h @@ -132,74 +132,10 @@ Py_LOCAL_INLINE(int64_t) PyC_Long_AsI64(PyObject *value) { return (int64_t)PyLo Py_LOCAL_INLINE(uint64_t) PyC_Long_AsU64(PyObject *value) { return (uint64_t)PyLong_AsUnsignedLongLong(value); } /* utils for format string in `struct` module style syntax */ -Py_LOCAL_INLINE(char) PyC_Formatchar_get(const char *typestr) -{ - switch (typestr[0]) { - case '!': - case '<': - case '=': - case '>': - case '@': - return typestr[1]; - default: - return typestr[0]; - } -} - -Py_LOCAL_INLINE(bool) PyC_Formatchar_is_floating_type(char format) -{ - switch (format) { - case 'f': - case 'd': - case 'e': - return true; - default: - return false; - } -} - -Py_LOCAL_INLINE(bool) PyC_Formatchar_is_integer_type(char format) -{ - switch (format) { - case 'i': - case 'I': - case 'l': - case 'L': - case 'h': - case 'H': - case 'b': - case 'B': - case 'q': - case 'Q': - case 'n': - case 'N': - case 'P': - return true; - default: - return false; - } -} - -Py_LOCAL_INLINE(bool) PyC_Formatchar_is_byte_type(char format) -{ - switch (format) { - case 'c': - case 's': - case 'p': - return true; - default: - return false; - } -} - -Py_LOCAL_INLINE(bool) PyC_Formatchar_is_boolean_type(char format) -{ - switch (format) { - case '?': - return true; - default: - return false; - } -} +char PyC_Formatchar_get(const char *typestr); +bool PyC_Formatchar_is_floating_type(char format); +bool PyC_Formatchar_is_integer_type(char format); +bool PyC_Formatchar_is_byte_type(char format); +bool PyC_Formatchar_is_boolean_type(char format); #endif /* __PY_CAPI_UTILS_H__ */ |