X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Flib%2Fgraph%2Fport.c;h=52ebc7f851b5c3de39ce8452ef6b886499363ebb;hb=d98421f2abfc5adab28ab7ee9b63537a6c7261cc;hp=f5a0d7322fbb42c0b15aba7b0e34bba996004a70;hpb=3f7d4d90b0456de9d34fac337350818ef06163bd;p=babeltrace.git diff --git a/src/lib/graph/port.c b/src/lib/graph/port.c index f5a0d732..52ebc7f8 100644 --- a/src/lib/graph/port.c +++ b/src/lib/graph/port.c @@ -1,37 +1,17 @@ /* + * SPDX-License-Identifier: MIT + * * Copyright 2017-2018 Philippe Proulx * Copyright 2017 Jérémie Galarneau - * - * 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. */ -#define BT_LOG_TAG "PORT" -#include "lib/lib-logging.h" +#define BT_LOG_TAG "LIB/PORT" +#include "lib/logging.h" #include "common/assert.h" -#include "lib/assert-pre.h" -#include -#include -#include +#include "lib/assert-cond.h" +#include #include -#include -#include #include "lib/object.h" #include "compat/compiler.h" @@ -66,7 +46,7 @@ struct bt_port *bt_port_create(struct bt_component *parent_component, BT_ASSERT(strlen(name) > 0); port = g_new0(struct bt_port, 1); if (!port) { - BT_LOGE_STR("Failed to allocate one port."); + BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate one port."); goto end; } @@ -76,7 +56,7 @@ struct bt_port *bt_port_create(struct bt_component *parent_component, bt_object_init_shared_with_parent(&port->base, destroy_port); port->name = g_string_new(name); if (!port->name) { - BT_LOGE_STR("Failed to allocate one GString."); + BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate one GString."); BT_OBJECT_PUT_REF_AND_RESET(port); goto end; } @@ -93,34 +73,34 @@ end: const char *bt_port_get_name(const struct bt_port *port) { - BT_ASSERT_PRE_NON_NULL(port, "Port"); + BT_ASSERT_PRE_DEV_NON_NULL(port, "Port"); return port->name->str; } enum bt_port_type bt_port_get_type(const struct bt_port *port) { - BT_ASSERT_PRE_NON_NULL(port, "Port"); + BT_ASSERT_PRE_DEV_NON_NULL(port, "Port"); return port->type; } const struct bt_connection *bt_port_borrow_connection_const( const struct bt_port *port) { - BT_ASSERT_PRE_NON_NULL(port, "Port"); + BT_ASSERT_PRE_DEV_NON_NULL(port, "Port"); return port->connection; } const struct bt_component *bt_port_borrow_component_const( const struct bt_port *port) { - BT_ASSERT_PRE_NON_NULL(port, "Port"); + BT_ASSERT_PRE_DEV_NON_NULL(port, "Port"); return bt_port_borrow_component_inline(port); } struct bt_self_component *bt_self_component_port_borrow_component( struct bt_self_component_port *port) { - BT_ASSERT_PRE_NON_NULL(port, "Port"); + BT_ASSERT_PRE_DEV_NON_NULL(port, "Port"); return (void *) bt_object_borrow_parent((void *) port); } @@ -140,13 +120,13 @@ void bt_port_set_connection(struct bt_port *port, bt_bool bt_port_is_connected(const struct bt_port *port) { - BT_ASSERT_PRE_NON_NULL(port, "Port"); + BT_ASSERT_PRE_DEV_NON_NULL(port, "Port"); return port->connection ? BT_TRUE : BT_FALSE; } void *bt_self_component_port_get_data(const struct bt_self_component_port *port) { - BT_ASSERT_PRE_NON_NULL(port, "Port"); + BT_ASSERT_PRE_DEV_NON_NULL(port, "Port"); return ((struct bt_port *) port)->user_data; }