From 3e07eac87b2be2f2b2c3099d76ea41cb476b6613 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 2 Mar 2019 01:30:59 +1100 Subject: Cleanup: use variable instead of define --- source/blender/python/intern/bpy_rna_callback.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'source/blender/python') 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; -- cgit v1.2.3