lib: trace IR, values: reset pointers to `NULL` on destruction
[babeltrace.git] / lib / trace-ir / event-class.c
index 9574a9da415f6c44eec7e18c08b70b4965f26c98..685c09c32b2153ce2d65bad7072a05e590de81f0 100644 (file)
@@ -63,16 +63,18 @@ void destroy_event_class(struct bt_object *obj)
 
        if (event_class->name.str) {
                g_string_free(event_class->name.str, TRUE);
+               event_class->name.str = NULL;
        }
 
        if (event_class->emf_uri.str) {
                g_string_free(event_class->emf_uri.str, TRUE);
+               event_class->emf_uri.str = NULL;
        }
 
        BT_LOGD_STR("Putting context field classe.");
-       bt_object_put_ref(event_class->specific_context_fc);
+       BT_OBJECT_PUT_REF_AND_RESET(event_class->specific_context_fc);
        BT_LOGD_STR("Putting payload field classe.");
-       bt_object_put_ref(event_class->payload_fc);
+       BT_OBJECT_PUT_REF_AND_RESET(event_class->payload_fc);
        bt_object_pool_finalize(&event_class->event_pool);
        g_free(obj);
 }
@@ -227,7 +229,7 @@ enum bt_property_availability bt_event_class_get_log_level(
        return event_class->log_level.base.avail;
 }
 
-int bt_private_event_class_set_log_level(
+void bt_private_event_class_set_log_level(
                struct bt_private_event_class *priv_event_class,
                enum bt_event_class_log_level log_level)
 {
@@ -238,7 +240,6 @@ int bt_private_event_class_set_log_level(
        bt_property_uint_set(&event_class->log_level,
                (uint64_t) log_level);
        BT_LIB_LOGV("Set event class's log level: %!+E", event_class);
-       return 0;
 }
 
 const char *bt_event_class_get_emf_uri(struct bt_event_class *event_class)
@@ -270,7 +271,7 @@ struct bt_stream_class *bt_event_class_borrow_stream_class(
 }
 
 struct bt_private_stream_class *
-bt_private_event_class_borrow_private_stream_class(
+bt_private_event_class_borrow_stream_class(
                struct bt_private_event_class *event_class)
 {
        return (void *) bt_event_class_borrow_stream_class(
@@ -285,14 +286,14 @@ struct bt_field_class *bt_event_class_borrow_specific_context_field_class(
 }
 
 struct bt_private_field_class *
-bt_private_event_class_borrow_specific_context_private_field_class(
+bt_private_event_class_borrow_specific_context_field_class(
                struct bt_private_event_class *event_class)
 {
        return (void *) bt_event_class_borrow_specific_context_field_class(
                (void *) event_class);
 }
 
-int bt_private_event_class_set_specific_context_private_field_class(
+int bt_private_event_class_set_specific_context_field_class(
                struct bt_private_event_class *priv_event_class,
                struct bt_private_field_class *priv_field_class)
 {
@@ -349,14 +350,14 @@ struct bt_field_class *bt_event_class_borrow_payload_field_class(
        return event_class->payload_fc;
 }
 
-struct bt_private_field_class *bt_private_event_class_borrow_payload_private_field_class(
+struct bt_private_field_class *bt_private_event_class_borrow_payload_field_class(
                struct bt_private_event_class *event_class)
 {
        return (void *) bt_event_class_borrow_payload_field_class(
                (void *) event_class);
 }
 
-int bt_private_event_class_set_payload_private_field_class(
+int bt_private_event_class_set_payload_field_class(
                struct bt_private_event_class *priv_event_class,
                struct bt_private_field_class *priv_field_class)
 {
@@ -414,9 +415,3 @@ void _bt_event_class_freeze(struct bt_event_class *event_class)
        BT_LIB_LOGD("Freezing event class: %!+E", event_class);
        event_class->frozen = true;
 }
-
-struct bt_event_class *bt_event_class_borrow_from_private(
-               struct bt_private_event_class *priv_event_class)
-{
-       return (void *) priv_event_class;
-}
This page took 0.025045 seconds and 4 git commands to generate.