bt2: make bt_bt2_trace_{,class}_add_destruction_listener return a status
[babeltrace.git] / src / bindings / python / bt2 / bt2 / native_bt_trace.i
index 3448f646492cec8ef54060119e8a5e4cb7c1ef7d..1ecc47204a483a9c8cf304232146563df2dc077c 100644 (file)
@@ -50,24 +50,22 @@ trace_destroyed_listener(const bt_trace *trace, void *py_callable)
        Py_XDECREF(py_res);
 }
 
-uint64_t bt_bt2_trace_add_destruction_listener(bt_trace *trace, PyObject *py_callable)
+int bt_bt2_trace_add_destruction_listener(bt_trace *trace,
+               PyObject *py_callable, uint64_t *id)
 {
-       uint64_t id = UINT64_C(-1);
        bt_trace_add_listener_status status;
 
        BT_ASSERT(trace);
        BT_ASSERT(py_callable);
        status = bt_trace_add_destruction_listener(
-               trace, trace_destroyed_listener, py_callable, &id);
-       if (status != __BT_FUNC_STATUS_OK) {
-               BT_LOGF_STR("Failed to add trace destruction listener.");
-               abort();
+               trace, trace_destroyed_listener, py_callable, id);
+       if (status == __BT_FUNC_STATUS_OK) {
+               Py_INCREF(py_callable);
        }
 
-       Py_INCREF(py_callable);
-       return id;
+       return status;
 }
 %}
 
-uint64_t bt_bt2_trace_add_destruction_listener(bt_trace *trace,
-       PyObject *py_callable);
+int bt_bt2_trace_add_destruction_listener(bt_trace *trace,
+               PyObject *py_callable, uint64_t *id);
This page took 0.028047 seconds and 4 git commands to generate.