X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fctf-writer%2Fvalues.c;h=3eeed2d3664e1c8259162a1d0434ab7ae82a2f15;hb=5c97e2daa9712d1fc3e1df186b25367b1e4cb8b1;hp=89a808d4e0e98c29eab045f0bca374f19547cb39;hpb=004090977e6698a39035bb20b5ba4d5da23a6718;p=babeltrace.git diff --git a/src/ctf-writer/values.c b/src/ctf-writer/values.c index 89a808d4..3eeed2d3 100644 --- a/src/ctf-writer/values.c +++ b/src/ctf-writer/values.c @@ -1,24 +1,8 @@ /* + * SPDX-License-Identifier: MIT + * * Copyright (c) 2015 EfficiOS Inc. and Linux Foundation * Copyright (c) 2015 Philippe Proulx - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. */ #define BT_LOG_TAG "CTF-WRITER/VALUES" @@ -28,7 +12,7 @@ #include #include -#include +#include #include #include "common/assert.h" @@ -221,7 +205,7 @@ struct bt_ctf_private_value *bt_ctf_value_array_copy(const struct bt_ctf_value * bt_ctf_value_array_borrow_element_by_index( array_obj, i); - BT_ASSERT(element_obj); + BT_ASSERT_DBG(element_obj); BT_LOGD("Copying array value's element: element-addr=%p, " "index=%d", element_obj, i); ret = bt_ctf_value_copy(&element_obj_copy, element_obj); @@ -233,7 +217,7 @@ struct bt_ctf_private_value *bt_ctf_value_array_copy(const struct bt_ctf_value * goto end; } - BT_ASSERT(element_obj_copy); + BT_ASSERT_DBG(element_obj_copy); ret = bt_ctf_private_value_array_append_element(copy_obj, (void *) element_obj_copy); BT_CTF_OBJECT_PUT_REF_AND_RESET(element_obj_copy); @@ -274,7 +258,7 @@ struct bt_ctf_private_value *bt_ctf_value_map_copy(const struct bt_ctf_value *ma while (g_hash_table_iter_next(&iter, &key, &element_obj)) { const char *key_str = g_quark_to_string(GPOINTER_TO_UINT(key)); - BT_ASSERT(key_str); + BT_ASSERT_DBG(key_str); BT_LOGD("Copying map value's element: element-addr=%p, " "key=\"%s\"", element_obj, key_str); ret = bt_ctf_value_copy(&element_obj_copy, element_obj); @@ -286,7 +270,7 @@ struct bt_ctf_private_value *bt_ctf_value_map_copy(const struct bt_ctf_value *ma goto end; } - BT_ASSERT(element_obj_copy); + BT_ASSERT_DBG(element_obj_copy); ret = bt_ctf_private_value_map_insert_entry(copy_obj, key_str, (void *) element_obj_copy); BT_CTF_OBJECT_PUT_REF_AND_RESET(element_obj_copy); @@ -400,14 +384,14 @@ bt_ctf_bool bt_ctf_value_array_compare(const struct bt_ctf_value *object_a, const struct bt_ctf_value_array *array_obj_a = BT_CTF_VALUE_TO_ARRAY(object_a); - if (bt_ctf_value_array_get_size(object_a) != - bt_ctf_value_array_get_size(object_b)) { + if (bt_ctf_value_array_get_length(object_a) != + bt_ctf_value_array_get_length(object_b)) { BT_LOGT("Array values are different: size mismatch " "value-a-addr=%p, value-b-addr=%p, " "value-a-size=%" PRId64 ", value-b-size=%" PRId64, object_a, object_b, - bt_ctf_value_array_get_size(object_a), - bt_ctf_value_array_get_size(object_b)); + bt_ctf_value_array_get_length(object_a), + bt_ctf_value_array_get_length(object_b)); ret = BT_CTF_FALSE; goto end; } @@ -566,7 +550,7 @@ enum bt_ctf_value_status _bt_ctf_value_freeze(struct bt_ctf_value *object) { enum bt_ctf_value_status ret = BT_CTF_VALUE_STATUS_OK; - BT_ASSERT(object); + BT_ASSERT_DBG(object); if (object->frozen) { goto end; @@ -854,7 +838,7 @@ enum bt_ctf_value_status bt_ctf_private_value_string_set( } BT_HIDDEN -uint64_t bt_ctf_value_array_get_size(const struct bt_ctf_value *array_obj) +uint64_t bt_ctf_value_array_get_length(const struct bt_ctf_value *array_obj) { BT_CTF_ASSERT_PRE_NON_NULL(array_obj, "Value object"); BT_CTF_ASSERT_PRE_VALUE_IS_TYPE(array_obj, BT_CTF_VALUE_TYPE_ARRAY); @@ -1212,7 +1196,7 @@ bt_ctf_bool extend_map_element(const char *key, goto error; } - BT_ASSERT(extension_obj_elem_copy); + BT_ASSERT_DBG(extension_obj_elem_copy); /* Replace in extended object */ extend_data->status = bt_ctf_private_value_map_insert_entry( @@ -1229,7 +1213,7 @@ bt_ctf_bool extend_map_element(const char *key, goto end; error: - BT_ASSERT(extend_data->status != BT_CTF_VALUE_STATUS_OK); + BT_ASSERT_DBG(extend_data->status != BT_CTF_VALUE_STATUS_OK); ret = BT_CTF_FALSE; end: @@ -1266,7 +1250,7 @@ enum bt_ctf_value_status bt_ctf_value_map_extend( goto error; } - BT_ASSERT(extended_map_obj); + BT_ASSERT_DBG(extended_map_obj); /* * For each key in the extension map object, replace this key