X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fbindings%2Fpython%2Fbt2%2Fbt2%2Fnative_bt_trace.i.h;h=7d4c68825b3d0826631013c6f21fda18bfe1f78b;hb=HEAD;hp=708142e648ea670a3482502c623d36ffabc1063e;hpb=4212232cdba456554343e71b2449066e597d0f5b;p=babeltrace.git diff --git a/src/bindings/python/bt2/bt2/native_bt_trace.i.h b/src/bindings/python/bt2/bt2/native_bt_trace.i.h index 708142e6..bccdf875 100644 --- a/src/bindings/python/bt2/bt2/native_bt_trace.i.h +++ b/src/bindings/python/bt2/bt2/native_bt_trace.i.h @@ -1,27 +1,12 @@ /* - * The MIT License (MIT) + * SPDX-License-Identifier: MIT * * Copyright (c) 2016 Philippe Proulx - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. */ +#ifndef BABELTRACE_BINDINGS_PYTHON_BT2_BT2_NATIVE_BT_TRACE_I_H +#define BABELTRACE_BINDINGS_PYTHON_BT2_BT2_NATIVE_BT_TRACE_I_H + static void trace_destroyed_listener(const bt_trace *trace, void *py_callable) { @@ -32,17 +17,18 @@ trace_destroyed_listener(const bt_trace *trace, void *py_callable) SWIGTYPE_p_bt_trace, 0); if (!py_trace_ptr) { BT_LOGF_STR("Failed to create a SWIG pointer object."); - abort(); + bt_common_abort(); } py_res = PyObject_CallFunction(py_callable, "(O)", py_trace_ptr); - if (py_res) { - BT_ASSERT(py_res == Py_None); - } else { - loge_exception("Trace's destruction listener (Python)", - BT_LOG_OUTPUT_LEVEL); + if (!py_res) { + logw_exception_clear(BT_LOG_OUTPUT_LEVEL); + goto end; } + BT_ASSERT(py_res == Py_None); + +end: Py_DECREF(py_trace_ptr); Py_XDECREF(py_res); } @@ -63,3 +49,5 @@ int bt_bt2_trace_add_destruction_listener(bt_trace *trace, return status; } + +#endif /* BABELTRACE_BINDINGS_PYTHON_BT2_BT2_NATIVE_BT_TRACE_I_H */