Remove useless component/iterator validation functions
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 25 May 2017 22:01:09 +0000 (18:01 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 28 May 2017 16:57:45 +0000 (12:57 -0400)
They only "validate" what we can assert anyway.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
include/babeltrace/graph/component-filter-internal.h
include/babeltrace/graph/component-sink-internal.h
include/babeltrace/graph/component-source-internal.h
include/babeltrace/graph/notification-iterator-internal.h
lib/graph/component.c
lib/graph/connection.c
lib/graph/filter.c
lib/graph/iterator.c
lib/graph/sink.c
lib/graph/source.c

index 15db1bb6b97f724e214c18235c32d564080ec101..3bf79a187cc55b67bb8669c7b60136f50f2aa886 100644 (file)
@@ -51,14 +51,4 @@ struct bt_component *bt_component_filter_create(
 BT_HIDDEN
 void bt_component_filter_destroy(struct bt_component *component);
 
-/**
- * Validate a filter component.
- *
- * @param component            Filter component instance to validate
- * @returns                    One of #bt_component_status
- */
-BT_HIDDEN
-enum bt_component_status bt_component_filter_validate(
-               struct bt_component *component);
-
 #endif /* BABELTRACE_COMPONENT_FILTER_INTERNAL_H */
index 84c37f2a266e9e501eb63c7ca3a55b24b8b1040b..cffb9a9648b23830e11e1c6da3ad24708ab8239f 100644 (file)
@@ -54,16 +54,6 @@ struct bt_component *bt_component_sink_create(
 BT_HIDDEN
 void bt_component_sink_destroy(struct bt_component *component);
 
-/**
- * Validate a sink component.
- *
- * @param component            Sink component instance to validate
- * @returns                    One of #bt_component_status
- */
-BT_HIDDEN
-enum bt_component_status bt_component_sink_validate(
-               struct bt_component *component);
-
 /**
  * Process one event, consuming from sources as needed.
  *
index fa53bf04c8a9cc510b41d6b8d012808558e4cd72..fde158453504edf7ad225a0a59e4f82b7a562386 100644 (file)
@@ -51,14 +51,4 @@ struct bt_component *bt_component_source_create(
 BT_HIDDEN
 void bt_component_source_destroy(struct bt_component *component);
 
-/**
- * Validate a source component.
- *
- * @param component            Source component instance to validate
- * @returns                    One of #bt_component_status
- */
-BT_HIDDEN
-enum bt_component_status bt_component_source_validate(
-               struct bt_component *component);
-
 #endif /* BABELTRACE_COMPONENT_SOURCE_INTERNAL_H */
index ebbd01fcbceb74c442a27cc54cb7eaacf09795c7..7b748e7bff10fd4c78b4181b2a5b5325eb489203 100644 (file)
@@ -145,16 +145,6 @@ struct bt_notification_iterator *bt_notification_iterator_create(
                const enum bt_notification_type *notification_types,
                struct bt_connection *connection);
 
-/**
- * Validate a notification iterator.
- *
- * @param iterator             Notification iterator instance
- * @returns                    One of #bt_component_status values
- */
-BT_HIDDEN
-enum bt_notification_iterator_status bt_notification_iterator_validate(
-               struct bt_notification_iterator *iterator);
-
 BT_HIDDEN
 void bt_notification_iterator_finalize(
                struct bt_notification_iterator *iterator);
index 7a5c382a5f8daeb9951fdada33e096d89872be67..9fad68ac968074a71c0aeb6c017c954599e85e25 100644 (file)
@@ -65,14 +65,6 @@ void (*component_destroy_funcs[])(struct bt_component *) = {
        [BT_COMPONENT_CLASS_TYPE_FILTER] = bt_component_filter_destroy,
 };
 
-static
-enum bt_component_status (* const component_validation_funcs[])(
-               struct bt_component *) = {
-       [BT_COMPONENT_CLASS_TYPE_SOURCE] = bt_component_source_validate,
-       [BT_COMPONENT_CLASS_TYPE_SINK] = bt_component_sink_validate,
-       [BT_COMPONENT_CLASS_TYPE_FILTER] = bt_component_filter_validate,
-};
-
 static
 void bt_component_destroy(struct bt_object *obj)
 {
@@ -350,14 +342,6 @@ struct bt_component *bt_component_create_with_init_method_data(
                }
        }
 
-       ret = component_validation_funcs[type](component);
-       if (ret != BT_COMPONENT_STATUS_OK) {
-               BT_LOGW("Component is invalid: status=%s",
-                       bt_component_status_string(ret));
-               BT_PUT(component);
-               goto end;
-       }
-
        BT_LOGD_STR("Freezing component class.");
        bt_component_class_freeze(component->class);
        BT_LOGD("Created component from component class: "
index 96eed0f329aaaaf9e9ea394a1ebe08e8f67c66b8..896ce27085700985e086a7af411a14a6606996e4 100644 (file)
@@ -276,7 +276,6 @@ bt_private_connection_create_notification_iterator(
                struct bt_private_connection *private_connection,
                const enum bt_notification_type *notification_types)
 {
-       enum bt_notification_iterator_status ret_iterator;
        enum bt_component_class_type upstream_comp_class_type;
        struct bt_notification_iterator *iterator = NULL;
        struct bt_port *upstream_port = NULL;
@@ -374,13 +373,6 @@ bt_private_connection_create_notification_iterator(
                }
        }
 
-       ret_iterator = bt_notification_iterator_validate(iterator);
-       if (ret_iterator != BT_NOTIFICATION_ITERATOR_STATUS_OK) {
-               BT_LOGW("Notification iterator is invalid: status=%s",
-                       bt_notification_iterator_status_string(ret_iterator));
-               goto error;
-       }
-
        g_ptr_array_add(connection->iterators, iterator);
        BT_LOGD("Created notification iterator from connection: "
                "conn-addr=%p, upstream-port-addr=%p, "
index aaab3b78c91f6b7b0c9a20775f384521e00e5741..8d2964e1b68f86f315e09c12f3c71077371b5961 100644 (file)
@@ -54,32 +54,6 @@ end:
        return filter ? &filter->parent : NULL;
 }
 
-BT_HIDDEN
-enum bt_component_status bt_component_filter_validate(
-               struct bt_component *component)
-{
-       enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
-
-       if (!component) {
-               ret = BT_COMPONENT_STATUS_INVALID;
-               goto end;
-       }
-
-       if (!component->class) {
-               ret = BT_COMPONENT_STATUS_INVALID;
-               goto end;
-       }
-
-       if (component->class->type != BT_COMPONENT_CLASS_TYPE_FILTER) {
-               ret = BT_COMPONENT_STATUS_INVALID;
-               goto end;
-       }
-
-       /* Enforce iterator limits. */
-end:
-       return ret;
-}
-
 int64_t bt_component_filter_get_input_port_count(
                struct bt_component *component)
 {
index 6819a2e9aead906f3765a251661e48081528d377..56f4a2512e2227dbb2bccd8bde57adf4654e3b15 100644 (file)
@@ -510,21 +510,6 @@ end:
        return iterator;
 }
 
-BT_HIDDEN
-enum bt_notification_iterator_status bt_notification_iterator_validate(
-               struct bt_notification_iterator *iterator)
-{
-       enum bt_notification_iterator_status ret =
-                       BT_NOTIFICATION_ITERATOR_STATUS_OK;
-
-       if (!iterator) {
-               ret = BT_NOTIFICATION_ITERATOR_STATUS_INVALID;
-               goto end;
-       }
-end:
-       return ret;
-}
-
 void *bt_private_notification_iterator_get_user_data(
                struct bt_private_notification_iterator *private_iterator)
 {
index e99d111f4309fa87711fe4331a47bad66b5fd0f4..a2ab200690ff7f1a8e37f776debb03e6cdf075f6 100644 (file)
 #include <babeltrace/graph/component-internal.h>
 #include <babeltrace/graph/notification.h>
 
-BT_HIDDEN
-enum bt_component_status bt_component_sink_validate(
-               struct bt_component *component)
-{
-       enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
-
-       if (!component) {
-               ret = BT_COMPONENT_STATUS_INVALID;
-               goto end;
-       }
-
-       if (!component->class) {
-               ret = BT_COMPONENT_STATUS_INVALID;
-               goto end;
-       }
-
-       if (component->class->type != BT_COMPONENT_CLASS_TYPE_SINK) {
-               ret = BT_COMPONENT_STATUS_INVALID;
-               goto end;
-       }
-end:
-       return ret;
-}
-
 BT_HIDDEN
 void bt_component_sink_destroy(struct bt_component *component)
 {
index 566d1c0eb0229df36712a2bfccec2c208fcffd5b..9682570807349f626f0eb84b90e5e0737d2c68ad 100644 (file)
 #include <babeltrace/graph/notification-iterator.h>
 #include <babeltrace/graph/notification-iterator-internal.h>
 
-BT_HIDDEN
-enum bt_component_status bt_component_source_validate(
-               struct bt_component *component)
-{
-       enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
-
-       if (!component) {
-               ret = BT_COMPONENT_STATUS_INVALID;
-               goto end;
-       }
-
-       if (!component->class) {
-               ret = BT_COMPONENT_STATUS_INVALID;
-               goto end;
-       }
-
-       if (component->class->type != BT_COMPONENT_CLASS_TYPE_SOURCE) {
-               ret = BT_COMPONENT_STATUS_INVALID;
-               goto end;
-       }
-
-end:
-       return ret;
-}
-
 BT_HIDDEN
 void bt_component_source_destroy(struct bt_component *component)
 {
This page took 0.028984 seconds and 4 git commands to generate.