lib: de-duplicate "no error" assertion in add port functions
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 17 May 2023 19:29:38 +0000 (15:29 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Sun, 21 May 2023 12:02:12 +0000 (08:02 -0400)
Add BT_ASSERT_PRE_NO_ERROR_FROM_FUNC calls in
bt_component_add_output_port and bt_component_add_input_port, and remove
the equivalent calls in their callers.  This moves the assertion check
next to the other existing assertions.

Change-Id: Ia251510ce2b6ba369cfc1f4afae50e8e46060957
Reviewed-on: https://review.lttng.org/c/babeltrace/+/10036
CI-Build: Simon Marchi <simon.marchi@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
src/lib/graph/component-filter.c
src/lib/graph/component-sink.c
src/lib/graph/component-source.c
src/lib/graph/component.c

index ba940dea6d19b252bd579b92c016e77a81cf310d..79e577454452c0c1cf533054b79febbd7546f60d 100644 (file)
@@ -128,8 +128,6 @@ enum bt_self_component_add_port_status bt_self_component_filter_add_output_port(
        enum bt_self_component_add_port_status status;
        struct bt_port *port = NULL;
 
-       BT_ASSERT_PRE_NO_ERROR();
-
        /*
         * bt_component_add_output_port() logs details/errors and checks
         * preconditions.
@@ -219,8 +217,6 @@ enum bt_self_component_add_port_status bt_self_component_filter_add_input_port(
        struct bt_port *port = NULL;
        struct bt_component *comp = (void *) self_comp;
 
-       BT_ASSERT_PRE_NO_ERROR();
-
        /*
         * bt_component_add_input_port() logs details/errors and checks
         * preconditions.
index fb006f98186b0d2a88f0d3f390a8e85a33c3abb2..37eda35a6b680119160b3b2c9ee51b452609300f 100644 (file)
@@ -127,8 +127,6 @@ enum bt_self_component_add_port_status bt_self_component_sink_add_input_port(
        struct bt_port *port = NULL;
        struct bt_component *comp = (void *) self_comp;
 
-       BT_ASSERT_PRE_NO_ERROR();
-
        /*
         * bt_component_add_input_port() logs details/errors and checks
         * preconditions.
index 1a8d7fce23b361d187876a4327b3e274a2f271ec..83f1ef6973194b4e4195848df332cb7d3cd07cd8 100644 (file)
@@ -128,8 +128,6 @@ enum bt_self_component_add_port_status bt_self_component_source_add_output_port(
        enum bt_self_component_add_port_status status;
        struct bt_port *port = NULL;
 
-       BT_ASSERT_PRE_NO_ERROR();
-
        /*
         * bt_component_add_output_port() logs details/errors and checks
         * preconditions.
index 85d6aae9a456930944316b8230b430242c72de6f..569a743e7c7cc555c8048f1c4d81d2c8db5000fa 100644 (file)
@@ -475,6 +475,7 @@ enum bt_self_component_add_port_status bt_component_add_input_port(
                struct bt_component *component, const char *name,
                void *user_data, struct bt_port **port, const char *api_func)
 {
+       BT_ASSERT_PRE_NO_ERROR_FROM_FUNC(api_func);
        BT_ASSERT_PRE_COMP_NON_NULL_FROM_FUNC(api_func, component);
        BT_ASSERT_PRE_NAME_NON_NULL_FROM_FUNC(api_func, name);
        BT_ASSERT_PRE_FROM_FUNC(api_func, "input-port-name-is-unique",
@@ -492,6 +493,7 @@ enum bt_self_component_add_port_status bt_component_add_output_port(
                void *user_data, struct bt_port **port,
                const char *api_func)
 {
+       BT_ASSERT_PRE_NO_ERROR_FROM_FUNC(api_func);
        BT_ASSERT_PRE_COMP_NON_NULL_FROM_FUNC(api_func, component);
        BT_ASSERT_PRE_NAME_NON_NULL_FROM_FUNC(api_func, name);
        BT_ASSERT_PRE_FROM_FUNC(api_func, "output-port-name-is-unique",
This page took 0.026351 seconds and 4 git commands to generate.