Add ctf fs iterator initialization
[babeltrace.git] / lib / plugin-system / component.c
index 5b424cd848bf85725cbc7963f59d2304d8a0c7ef..b580bb5d0ae89acc2acd433ce23dab643dbe1f87 100644 (file)
@@ -66,7 +66,7 @@ void bt_component_destroy(struct bt_object *obj)
         * instance.
         */
        if (component->user_destroy) {
-               component->user_destroy(component->user_data);
+               component->user_destroy(component);
        }
 
        if (component->destroy) {
@@ -133,7 +133,7 @@ struct bt_component *bt_component_create(
 
        component_class->init(component, params);
        ret = component_validation_funcs[type](component);
-       if (ret) {
+       if (ret != BT_COMPONENT_STATUS_OK) {
                BT_PUT(component);
                goto end;
        }
@@ -195,3 +195,18 @@ bt_component_set_private_data(struct bt_component *component,
 end:
        return ret;
 }
+
+enum bt_component_status bt_component_set_destroy_cb(
+               struct bt_component *component, bt_component_destroy_cb destroy)
+{
+       enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
+
+       if (!component) {
+               ret = BT_COMPONENT_STATUS_INVALID;
+               goto end;
+       }
+
+       component->user_destroy = destroy;
+end:
+       return ret;
+}
This page took 0.023782 seconds and 4 git commands to generate.