From ef42f2cbc8eb16df1a8e45650c652d227fd35ef4 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Wed, 1 Oct 2008 10:31:58 +0000 Subject: add functionality to enable debugging flags at runtime This code permit to set flags, separated by commas, space, tabulations, or colons. This flags activates debug functions like, suppressing validations of signatures or print debugging message about deallocations. The new flags are defined in /lasso/debug.h they can be set using an environment variable named LASSO_FLAG or a function named lasso_set_flag. There are two flags currently: - verify-signature: To deactivate it, pass 'no-verify-signature' inside LASSO_DEBUG. It desactivate signature verification, inside two functions: lasso_query_verify_signature and lasso_provider_verify_signature. - memory-debug: It enabled reporting of memory deallocation inside generic memory dellaocator for LassoNode objects and also in bindings. - lasso/xml/xml.c: do not free a null hash table pointer. --- bindings/python/wrapper_top.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'bindings/python') diff --git a/bindings/python/wrapper_top.c b/bindings/python/wrapper_top.c index 3a710ab7..b40c39f5 100644 --- a/bindings/python/wrapper_top.c +++ b/bindings/python/wrapper_top.c @@ -3,6 +3,7 @@ #include #include #include "../ghashtable.h" +#include "../../lasso/debug.h" GQuark lasso_wrapper_key; @@ -375,12 +376,12 @@ failure: static void PyGObjectPtr_dealloc(PyGObjectPtr *self) { -#ifdef LASSO_DEBUG - fprintf(stderr, "dealloc (%p ptr to %p (type:%s, rc:%d))\n", - self, self->obj, - G_OBJECT_TYPE_NAME(self->obj), - self->obj->ref_count); -#endif + if (lasso_flag_memory_debug) { + fprintf(stderr, "dealloc (%p ptr to %p (type:%s, rc:%d))\n", + self, self->obj, + G_OBJECT_TYPE_NAME(self->obj), + self->obj->ref_count); + } g_object_set_qdata_full(self->obj, lasso_wrapper_key, NULL, NULL); g_object_unref(self->obj); Py_XDECREF(self->typename); -- cgit