lib: trace IR, values: reset pointers to `NULL` on destruction
[babeltrace.git] / lib / values.c
index 82765958b31b177509af123902594b5ae32fbb20..ffe289c2bdeec5d44e3466619ebfbf0090866e60 100644 (file)
@@ -1,8 +1,4 @@
 /*
- * Values.c: value objects
- *
- * Babeltrace Library
- *
  * Copyright (c) 2015 EfficiOS Inc. and Linux Foundation
  * Copyright (c) 2015 Philippe Proulx <pproulx@efficios.com>
  *
@@ -134,6 +130,7 @@ static
 void bt_value_string_destroy(struct bt_value *object)
 {
        g_string_free(BT_VALUE_TO_STRING(object)->gstr, TRUE);
+       BT_VALUE_TO_STRING(object)->gstr = NULL;
 }
 
 static
@@ -144,6 +141,7 @@ void bt_value_array_destroy(struct bt_value *object)
         * of putting each contained object.
         */
        g_ptr_array_free(BT_VALUE_TO_ARRAY(object)->garray, TRUE);
+       BT_VALUE_TO_ARRAY(object)->garray = NULL;
 }
 
 static
@@ -155,6 +153,7 @@ void bt_value_map_destroy(struct bt_value *object)
         * be destroyed anyway.
         */
        g_hash_table_destroy(BT_VALUE_TO_MAP(object)->ght);
+       BT_VALUE_TO_MAP(object)->ght = NULL;
 }
 
 static
@@ -1200,8 +1199,8 @@ end:
 
 enum bt_value_status bt_value_map_extend(
                struct bt_private_value **extended_map_obj,
-               struct bt_value *base_map_obj,
-               struct bt_value *extension_obj)
+               const struct bt_value *base_map_obj,
+               const struct bt_value *extension_obj)
 {
        struct extend_map_element_data extend_data = {
                .extended_obj = NULL,
@@ -1303,9 +1302,3 @@ bt_bool bt_value_compare(const struct bt_value *object_a,
 end:
        return ret;
 }
-
-struct bt_value *bt_value_borrow_from_private(
-               struct bt_private_value *priv_value)
-{
-       return (void *) priv_value;
-}
This page took 0.035719 seconds and 4 git commands to generate.