lib: merge `assert-pre.h` and `assert-post.h` into `assert-cond.h`
[babeltrace.git] / src / lib / graph / component.c
index 26da38be78524a77c578898fd8d4a259a2f2b18e..7660425c91c9d38b76f5ba8ee5fd4328b8816d05 100644 (file)
@@ -10,8 +10,7 @@
 
 #include "common/common.h"
 #include "common/assert.h"
-#include "lib/assert-pre.h"
-#include "lib/assert-post.h"
+#include "lib/assert-cond.h"
 #include <babeltrace2/graph/self-component.h>
 #include <babeltrace2/graph/component.h>
 #include <babeltrace2/graph/graph.h>
@@ -464,6 +463,27 @@ enum bt_self_component_add_port_status bt_component_add_output_port(
                BT_PORT_TYPE_OUTPUT, name, user_data, port);
 }
 
+BT_HIDDEN
+bool bt_component_port_name_is_unique(GPtrArray *ports, const char *name)
+{
+       guint i;
+       bool unique;
+
+       for (i = 0; i < ports->len; i++) {
+               struct bt_port *port = g_ptr_array_index(ports, i);
+
+               if (strcmp(port->name->str, name) == 0) {
+                       unique = false;
+                       goto end;
+               }
+       }
+
+       unique = true;
+
+end:
+       return unique;
+}
+
 BT_HIDDEN
 enum bt_component_class_port_connected_method_status
 bt_component_port_connected(
This page took 0.028277 seconds and 4 git commands to generate.