[pygobject] Use Py_CLEAR for closure cleanup instead of test with Py_DECREF



commit 3c83bfb14b850670eb7c0208e55c120ca203f8af
Author: Simon Feltman <sfeltman src gnome org>
Date:   Sat Jul 27 21:10:07 2013 -0700

    Use Py_CLEAR for closure cleanup instead of test with Py_DECREF

 gi/pygi-closure.c |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)
---
diff --git a/gi/pygi-closure.c b/gi/pygi-closure.c
index 99e15a1..601db94 100644
--- a/gi/pygi-closure.c
+++ b/gi/pygi-closure.c
@@ -518,15 +518,8 @@ _pygi_invoke_closure_clear_py_data(PyGICClosure *invoke_closure)
 {
     PyGILState_STATE state = PyGILState_Ensure();
 
-    if (invoke_closure->function != NULL) {
-        Py_DECREF (invoke_closure->function);
-        invoke_closure->function = NULL;
-    }
-
-    if (invoke_closure->user_data != NULL) {
-        Py_DECREF (invoke_closure->user_data);
-        invoke_closure->user_data = NULL;
-    }
+    Py_CLEAR (invoke_closure->function);
+    Py_CLEAR (invoke_closure->user_data);
 
     PyGILState_Release (state);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]