bt2: normalize the code to use some commonly used patterns
[babeltrace.git] / src / bindings / python / bt2 / bt2 / native_bt_trace.i.h
index 03e6380acf2627e77197862c71a9217b7bb6bb46..26404afb9c6714e4b808d8e10f378d2e415e6c2b 100644 (file)
@@ -36,14 +36,16 @@ trace_destroyed_listener(const bt_trace *trace, void *py_callable)
        }
 
        py_res = PyObject_CallFunction(py_callable, "(O)", py_trace_ptr);
-       if (py_res) {
-               BT_ASSERT(py_res == Py_None);
-       } else {
+       if (!py_res) {
                loge_exception_append_cause(
                        "Trace's destruction listener (Python)",
                        BT_LOG_OUTPUT_LEVEL);
+               goto end;
        }
 
+       BT_ASSERT(py_res == Py_None);
+
+end:
        Py_DECREF(py_trace_ptr);
        Py_XDECREF(py_res);
 }
This page took 0.024019 seconds and 4 git commands to generate.