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>2019-03-01 17:30:59 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-03-01 17:30:59 +0300
commit3e07eac87b2be2f2b2c3099d76ea41cb476b6613 (patch)
treec2a84bf15147dfb2a262807c469d503b927c4584 /source/blender/python
parent33b03f7f68922efada6ec7518c4fa60e9acb620a (diff)
Cleanup: use variable instead of define
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/intern/bpy_rna_callback.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/source/blender/python/intern/bpy_rna_callback.c b/source/blender/python/intern/bpy_rna_callback.c
index c29e203c22a..025ea586fee 100644
--- a/source/blender/python/intern/bpy_rna_callback.c
+++ b/source/blender/python/intern/bpy_rna_callback.c
@@ -47,9 +47,9 @@
#include "../generic/python_utildefines.h"
-/* use this to stop other capsules from being mis-used */
-#define RNA_CAPSULE_ID "RNA_HANDLE"
-#define RNA_CAPSULE_ID_INVALID "RNA_HANDLE_REMOVED"
+/* Use this to stop other capsules from being mis-used. */
+static const char *rna_capsual_id = "RNA_HANDLE";
+static const char *rna_capsual_id_invalid = "RNA_HANDLE_REMOVED";
static const EnumPropertyItem region_draw_mode_items[] = {
{REGION_DRAW_POST_PIXEL, "POST_PIXEL", 0, "Post Pixel", ""},
@@ -165,7 +165,7 @@ PyObject *pyrna_callback_add(BPy_StructRNA *self, PyObject *args)
return NULL;
}
- return PyCapsule_New((void *)handle, RNA_CAPSULE_ID, NULL);
+ return PyCapsule_New((void *)handle, rna_capsual_id, NULL);
}
PyObject *pyrna_callback_remove(BPy_StructRNA *self, PyObject *args)
@@ -177,7 +177,7 @@ PyObject *pyrna_callback_remove(BPy_StructRNA *self, PyObject *args)
if (!PyArg_ParseTuple(args, "O!:callback_remove", &PyCapsule_Type, &py_handle))
return NULL;
- handle = PyCapsule_GetPointer(py_handle, RNA_CAPSULE_ID);
+ handle = PyCapsule_GetPointer(py_handle, rna_capsual_id);
if (handle == NULL) {
PyErr_SetString(PyExc_ValueError, "callback_remove(handle): NULL handle given, invalid or already removed");
@@ -196,7 +196,7 @@ PyObject *pyrna_callback_remove(BPy_StructRNA *self, PyObject *args)
}
/* don't allow reuse */
- PyCapsule_SetName(py_handle, RNA_CAPSULE_ID_INVALID);
+ PyCapsule_SetName(py_handle, rna_capsual_id_invalid);
Py_RETURN_NONE;
}
@@ -343,7 +343,7 @@ PyObject *pyrna_callback_classmethod_add(PyObject *UNUSED(self), PyObject *args)
return NULL;
}
- PyObject *ret = PyCapsule_New((void *)handle, RNA_CAPSULE_ID, NULL);
+ PyObject *ret = PyCapsule_New((void *)handle, rna_capsual_id, NULL);
/* Store 'args' in context as well as the handler custom-data,
* because the handle may be freed by Blender (new file, new window... etc) */
@@ -371,7 +371,7 @@ PyObject *pyrna_callback_classmethod_remove(PyObject *UNUSED(self), PyObject *ar
return NULL;
}
py_handle = PyTuple_GET_ITEM(args, 1);
- handle = PyCapsule_GetPointer(py_handle, RNA_CAPSULE_ID);
+ handle = PyCapsule_GetPointer(py_handle, rna_capsual_id);
if (handle == NULL) {
PyErr_SetString(PyExc_ValueError, "callback_remove(handler): NULL handler given, invalid or already removed");
return NULL;
@@ -438,7 +438,7 @@ PyObject *pyrna_callback_classmethod_remove(PyObject *UNUSED(self), PyObject *ar
/* don't allow reuse */
if (capsule_clear) {
Py_DECREF(handle_args);
- PyCapsule_SetName(py_handle, RNA_CAPSULE_ID_INVALID);
+ PyCapsule_SetName(py_handle, rna_capsual_id_invalid);
}
Py_RETURN_NONE;