#include <babeltrace/graph/connection-internal.h>
#include <babeltrace/object-internal.h>
#include <babeltrace/compiler-internal.h>
+#include <babeltrace/assert-internal.h>
static
void bt_port_destroy(struct bt_object *obj)
g_free(port);
}
-struct bt_port *bt_port_from_private_port(
+struct bt_port *bt_port_from_private(
struct bt_private_port *private_port)
{
- return bt_get(bt_port_from_private(private_port));
+ return bt_get(bt_port_borrow_from_private(private_port));
}
BT_HIDDEN
{
struct bt_port *port = NULL;
- assert(name);
- assert(parent_component);
- assert(type == BT_PORT_TYPE_INPUT || type == BT_PORT_TYPE_OUTPUT);
+ BT_ASSERT(name);
+ BT_ASSERT(parent_component);
+ BT_ASSERT(type == BT_PORT_TYPE_INPUT || type == BT_PORT_TYPE_OUTPUT);
if (strlen(name) == 0) {
BT_LOGW_STR("Invalid parameter: name is an empty string.");
struct bt_private_port *private_port)
{
return bt_private_connection_from_connection(bt_port_get_connection(
- bt_port_from_private(private_port)));
+ bt_port_borrow_from_private(private_port)));
}
struct bt_private_component *bt_private_port_get_private_component(
struct bt_private_port *private_port)
{
return bt_private_component_from_component(bt_port_get_component(
- bt_port_from_private(private_port)));
+ bt_port_borrow_from_private(private_port)));
}
BT_HIDDEN
struct bt_private_port *private_port)
{
enum bt_port_status status = BT_PORT_STATUS_OK;
- struct bt_port *port = bt_port_from_private(private_port);
+ struct bt_port *port = bt_port_borrow_from_private(private_port);
struct bt_component *comp = NULL;
enum bt_component_status comp_status;
/* bt_component_remove_port() logs details */
comp_status = bt_component_remove_port(comp, port);
- assert(comp_status != BT_COMPONENT_STATUS_INVALID);
+ BT_ASSERT(comp_status != BT_COMPONENT_STATUS_INVALID);
if (comp_status < 0) {
status = BT_PORT_STATUS_ERROR;
goto end;
struct bt_private_port *private_port)
{
return private_port ?
- bt_port_from_private(private_port)->user_data : NULL;
+ bt_port_borrow_from_private(private_port)->user_data : NULL;
}