diff options
author | mano-wii <germano.costa@ig.com.br> | 2018-10-05 05:52:49 +0300 |
---|---|---|
committer | mano-wii <germano.costa@ig.com.br> | 2018-10-05 05:53:57 +0300 |
commit | c15439bcdc52f90570dd22fc0f61b94bdf56145d (patch) | |
tree | 1659fed1accdfe09fde3686e05fbae295982b667 /source/blender/python/gpu/gpu_py_shader.c | |
parent | b0c1fe3618b0cbcb0a0ba239fb54f32fc3a12c77 (diff) |
Cleanup: use PyModule_AddIntConstant
Diffstat (limited to 'source/blender/python/gpu/gpu_py_shader.c')
-rw-r--r-- | source/blender/python/gpu/gpu_py_shader.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/source/blender/python/gpu/gpu_py_shader.c b/source/blender/python/gpu/gpu_py_shader.c index c8193e00f6a..64b208ed49f 100644 --- a/source/blender/python/gpu/gpu_py_shader.c +++ b/source/blender/python/gpu/gpu_py_shader.c @@ -45,21 +45,18 @@ static void bpygpu_shader_add_enum_objects(PyObject *submodule) { - PyObject *dict = PyModule_GetDict(submodule); - PyObject *item; - -#define PY_DICT_ADD_INT(x) PyDict_SetItemString(dict, #x, item = PyLong_FromLong(x)); Py_DECREF(item) +#define ADDCONST(x) PyModule_AddIntConstant(submodule, #x, x) /* Shaders */ - PY_DICT_ADD_INT(GPU_SHADER_2D_UNIFORM_COLOR); - PY_DICT_ADD_INT(GPU_SHADER_2D_FLAT_COLOR); - PY_DICT_ADD_INT(GPU_SHADER_2D_SMOOTH_COLOR); - PY_DICT_ADD_INT(GPU_SHADER_2D_IMAGE); - PY_DICT_ADD_INT(GPU_SHADER_3D_UNIFORM_COLOR); - PY_DICT_ADD_INT(GPU_SHADER_3D_FLAT_COLOR); - PY_DICT_ADD_INT(GPU_SHADER_3D_SMOOTH_COLOR); - -#undef PY_DICT_ADD_INT + ADDCONST(GPU_SHADER_2D_UNIFORM_COLOR); + ADDCONST(GPU_SHADER_2D_FLAT_COLOR); + ADDCONST(GPU_SHADER_2D_SMOOTH_COLOR); + ADDCONST(GPU_SHADER_2D_IMAGE); + ADDCONST(GPU_SHADER_3D_UNIFORM_COLOR); + ADDCONST(GPU_SHADER_3D_FLAT_COLOR); + ADDCONST(GPU_SHADER_3D_SMOOTH_COLOR); + +#undef ADDCONST } static int bpygpu_pyLong_as_shader_enum(PyObject *o) |