Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-06-03 13:25:07 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-06-03 13:25:07 +0400
commitb460674d64df7a598dc057a546e329eba6517287 (patch)
tree4b511485ceab172da19c48717e2e3e0dac7a2a80 /source/blender/python
parent6f1a64830ac03d5964580bd912ada80d095f62eb (diff)
Code cleanup: replace macro with function to reduce binary size
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/generic/bgl.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c
index 292d3317a2e..9b819977345 100644
--- a/source/blender/python/generic/bgl.c
+++ b/source/blender/python/generic/bgl.c
@@ -1381,10 +1381,16 @@ static struct PyModuleDef BGL_module_def = {
NULL, /* m_free */
};
+static void expp_addconst_int(PyObject *dict, const char *name, int value)
+{
+ PyObject *item;
+ PyDict_SetItemString(dict, name, item = PyLong_FromLong(value));
+ Py_DECREF(item);
+}
PyObject *BPyInit_bgl(void)
{
- PyObject *submodule, *dict, *item;
+ PyObject *submodule, *dict;
submodule = PyModule_Create(&BGL_module_def);
dict = PyModule_GetDict(submodule);
@@ -1394,11 +1400,7 @@ PyObject *BPyInit_bgl(void)
PyModule_AddObject(submodule, "Buffer", (PyObject *)&BGL_bufferType);
Py_INCREF((PyObject *)&BGL_bufferType);
-#define EXPP_ADDCONST(x) PyDict_SetItemString(dict, #x, item = PyLong_FromLong((int)x)); Py_DECREF(item)
-
-/* So, for example:
- * EXPP_ADDCONST(GL_CURRENT_BIT) becomes
- * PyDict_SetItemString(dict, "GL_CURRENT_BIT", item = PyLong_FromLong(GL_CURRENT_BIT)); Py_DECREF(item) */
+#define EXPP_ADDCONST(x) expp_addconst_int(dict, #x, x)
EXPP_ADDCONST(GL_CURRENT_BIT);
EXPP_ADDCONST(GL_POINT_BIT);