X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=src%2Flib%2Ftrace-ir%2Ffield.c;h=922b9abb8d4fac71329d2dd78e026874c891e262;hp=f10b893ddacbf5b41e5cc9743e7121916eb3b14e;hb=0235b0db7de5bcacdb3650c92461f2ce5eb2143d;hpb=fe4df857056b4a03898f1031f136359ce733b0f5 diff --git a/src/lib/trace-ir/field.c b/src/lib/trace-ir/field.c index f10b893d..922b9abb 100644 --- a/src/lib/trace-ir/field.c +++ b/src/lib/trace-ir/field.c @@ -1,24 +1,8 @@ /* + * SPDX-License-Identifier: MIT + * * Copyright 2017-2018 Philippe Proulx * Copyright 2013, 2014 Jérémie Galarneau - * - * 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 "LIB/FIELD" @@ -26,13 +10,13 @@ #include "lib/assert-pre.h" #include -#include #include "lib/object.h" #include "compat/compiler.h" #include "compat/fcntl.h" #include "common/align.h" #include "common/assert.h" #include +#include #include "field.h" #include "field-class.h" @@ -163,6 +147,7 @@ struct bt_field *create_string_field(struct bt_field_class *); static struct bt_field *create_structure_field(struct bt_field_class *); + static struct bt_field *create_static_array_field(struct bt_field_class *); @@ -175,26 +160,6 @@ struct bt_field *create_option_field(struct bt_field_class *); static struct bt_field *create_variant_field(struct bt_field_class *); -static -struct bt_field *(* const field_create_funcs[])(struct bt_field_class *) = { - [BT_FIELD_CLASS_TYPE_BOOL] = create_bool_field, - [BT_FIELD_CLASS_TYPE_BIT_ARRAY] = create_bit_array_field, - [BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER] = create_integer_field, - [BT_FIELD_CLASS_TYPE_SIGNED_INTEGER] = create_integer_field, - [BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION] = create_integer_field, - [BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION] = create_integer_field, - [BT_FIELD_CLASS_TYPE_SINGLE_PRECISION_REAL] = create_real_field, - [BT_FIELD_CLASS_TYPE_DOUBLE_PRECISION_REAL] = create_real_field, - [BT_FIELD_CLASS_TYPE_STRING] = create_string_field, - [BT_FIELD_CLASS_TYPE_STRUCTURE] = create_structure_field, - [BT_FIELD_CLASS_TYPE_STATIC_ARRAY] = create_static_array_field, - [BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY] = create_dynamic_array_field, - [BT_FIELD_CLASS_TYPE_OPTION] = create_option_field, - [BT_FIELD_CLASS_TYPE_VARIANT_WITHOUT_SELECTOR] = create_variant_field, - [BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_SELECTOR] = create_variant_field, - [BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_SELECTOR] = create_variant_field, -}; - static void destroy_bool_field(struct bt_field *field); @@ -222,26 +187,6 @@ void destroy_option_field(struct bt_field *field); static void destroy_variant_field(struct bt_field *field); -static -void (* const field_destroy_funcs[])(struct bt_field *) = { - [BT_FIELD_CLASS_TYPE_BOOL] = destroy_bool_field, - [BT_FIELD_CLASS_TYPE_BIT_ARRAY] = destroy_bit_array_field, - [BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER] = destroy_integer_field, - [BT_FIELD_CLASS_TYPE_SIGNED_INTEGER] = destroy_integer_field, - [BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION] = destroy_integer_field, - [BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION] = destroy_integer_field, - [BT_FIELD_CLASS_TYPE_SINGLE_PRECISION_REAL] = destroy_real_field, - [BT_FIELD_CLASS_TYPE_DOUBLE_PRECISION_REAL] = destroy_real_field, - [BT_FIELD_CLASS_TYPE_STRING] = destroy_string_field, - [BT_FIELD_CLASS_TYPE_STRUCTURE] = destroy_structure_field, - [BT_FIELD_CLASS_TYPE_STATIC_ARRAY] = destroy_array_field, - [BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY] = destroy_array_field, - [BT_FIELD_CLASS_TYPE_OPTION] = destroy_option_field, - [BT_FIELD_CLASS_TYPE_VARIANT_WITHOUT_SELECTOR] = destroy_variant_field, - [BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_SELECTOR] = destroy_variant_field, - [BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_SELECTOR] = destroy_variant_field, -}; - struct bt_field_class *bt_field_borrow_class(struct bt_field *field) { BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); @@ -267,7 +212,52 @@ struct bt_field *bt_field_create(struct bt_field_class *fc) struct bt_field *field = NULL; BT_ASSERT(fc); - field = field_create_funcs[fc->type](fc); + + switch (fc->type) { + case BT_FIELD_CLASS_TYPE_BOOL: + field = create_bool_field(fc); + break; + case BT_FIELD_CLASS_TYPE_BIT_ARRAY: + field = create_bit_array_field(fc); + break; + case BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER: + case BT_FIELD_CLASS_TYPE_SIGNED_INTEGER: + case BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION: + case BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION: + field = create_integer_field(fc); + break; + case BT_FIELD_CLASS_TYPE_SINGLE_PRECISION_REAL: + case BT_FIELD_CLASS_TYPE_DOUBLE_PRECISION_REAL: + field = create_real_field(fc); + break; + case BT_FIELD_CLASS_TYPE_STRING: + field = create_string_field(fc); + break; + case BT_FIELD_CLASS_TYPE_STRUCTURE: + field = create_structure_field(fc); + break; + case BT_FIELD_CLASS_TYPE_STATIC_ARRAY: + field = create_static_array_field(fc); + break; + case BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITHOUT_LENGTH_FIELD: + case BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITH_LENGTH_FIELD: + field = create_dynamic_array_field(fc); + break; + case BT_FIELD_CLASS_TYPE_OPTION_WITHOUT_SELECTOR_FIELD: + case BT_FIELD_CLASS_TYPE_OPTION_WITH_BOOL_SELECTOR_FIELD: + case BT_FIELD_CLASS_TYPE_OPTION_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD: + case BT_FIELD_CLASS_TYPE_OPTION_WITH_SIGNED_INTEGER_SELECTOR_FIELD: + field = create_option_field(fc); + break; + case BT_FIELD_CLASS_TYPE_VARIANT_WITHOUT_SELECTOR_FIELD: + case BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD: + case BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_INTEGER_SELECTOR_FIELD: + field = create_variant_field(fc); + break; + default: + bt_common_abort(); + } + if (!field) { BT_LIB_LOGE_APPEND_CAUSE("Cannot create field object from field class: " "%![fc-]+F", fc); @@ -287,7 +277,7 @@ void init_field(struct bt_field *field, struct bt_field_class *fc, bt_object_init_unique(&field->base); field->methods = methods; field->class = fc; - bt_object_get_no_null_check(fc); + bt_object_get_ref_no_null_check(fc); } static @@ -387,7 +377,8 @@ struct bt_field *create_string_field(struct bt_field_class *fc) sizeof(char), 1); if (!string_field->buf) { BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate a GArray."); - BT_OBJECT_PUT_REF_AND_RESET(string_field); + bt_field_destroy((void *) string_field); + string_field = NULL; goto end; } @@ -456,7 +447,8 @@ struct bt_field *create_structure_field(struct bt_field_class *fc) &struct_field->fields)) { BT_LIB_LOGE_APPEND_CAUSE( "Cannot create structure member fields: %![fc-]+F", fc); - BT_OBJECT_PUT_REF_AND_RESET(struct_field); + bt_field_destroy((void *) struct_field); + struct_field = NULL; goto end; } @@ -487,7 +479,8 @@ struct bt_field *create_option_field(struct bt_field_class *fc) "Failed to create option field's content field: " "%![opt-fc-]+F, %![content-fc-]+F", opt_fc, opt_fc->content_fc); - BT_OBJECT_PUT_REF_AND_RESET(opt_field); + bt_field_destroy((void *) opt_field); + opt_field = NULL; goto end; } @@ -516,7 +509,8 @@ struct bt_field *create_variant_field(struct bt_field_class *fc) &var_field->fields)) { BT_LIB_LOGE_APPEND_CAUSE("Cannot create variant member fields: " "%![fc-]+F", fc); - BT_OBJECT_PUT_REF_AND_RESET(var_field); + bt_field_destroy((void *) var_field); + var_field = NULL; goto end; } @@ -582,7 +576,8 @@ struct bt_field *create_static_array_field(struct bt_field_class *fc) if (init_array_field_fields(array_field)) { BT_LIB_LOGE_APPEND_CAUSE("Cannot create static array fields: " "%![fc-]+F", fc); - BT_OBJECT_PUT_REF_AND_RESET(array_field); + bt_field_destroy((void *) array_field); + array_field = NULL; goto end; } @@ -610,7 +605,8 @@ struct bt_field *create_dynamic_array_field(struct bt_field_class *fc) if (init_array_field_fields(array_field)) { BT_LIB_LOGE_APPEND_CAUSE("Cannot create dynamic array fields: " "%![fc-]+F", fc); - BT_OBJECT_PUT_REF_AND_RESET(array_field); + bt_field_destroy((void *) array_field); + array_field = NULL; goto end; } @@ -784,6 +780,7 @@ bt_field_enumeration_unsigned_get_mapping_labels( { const struct bt_field_integer *int_field = (const void *) field; + BT_ASSERT_PRE_DEV_NO_ERROR(); BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); BT_ASSERT_PRE_DEV_NON_NULL(label_array, "Label array (output)"); BT_ASSERT_PRE_DEV_NON_NULL(label_array, "Count (output)"); @@ -803,6 +800,7 @@ bt_field_enumeration_signed_get_mapping_labels( { const struct bt_field_integer *int_field = (const void *) field; + BT_ASSERT_PRE_DEV_NO_ERROR(); BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); BT_ASSERT_PRE_DEV_NON_NULL(label_array, "Label array (output)"); BT_ASSERT_PRE_DEV_NON_NULL(label_array, "Count (output)"); @@ -841,7 +839,7 @@ void clear_string_field(struct bt_field *field) { struct bt_field_string *string_field = (void *) field; - BT_ASSERT(field); + BT_ASSERT_DBG(field); string_field->length = 0; bt_field_set_single(field, true); } @@ -849,6 +847,7 @@ void clear_string_field(struct bt_field *field) enum bt_field_string_set_value_status bt_field_string_set_value( struct bt_field *field, const char *value) { + BT_ASSERT_PRE_DEV_NO_ERROR(); BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); BT_ASSERT_PRE_DEV_NON_NULL(value, "Value"); BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field"); @@ -862,6 +861,8 @@ enum bt_field_string_set_value_status bt_field_string_set_value( enum bt_field_string_append_status bt_field_string_append( struct bt_field *field, const char *value) { + BT_ASSERT_PRE_DEV_NO_ERROR(); + return bt_field_string_append_with_length(field, value, (uint64_t) strlen(value)); } @@ -873,6 +874,7 @@ enum bt_field_string_append_status bt_field_string_append_with_length( char *data; uint64_t new_length; + BT_ASSERT_PRE_DEV_NO_ERROR(); BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); BT_ASSERT_PRE_DEV_NON_NULL(value, "Value"); BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field"); @@ -922,9 +924,9 @@ enum bt_field_array_dynamic_set_length_status bt_field_array_dynamic_set_length( int ret = BT_FUNC_STATUS_OK; struct bt_field_array *array_field = (void *) field; + BT_ASSERT_PRE_DEV_NO_ERROR(); BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); - BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field, - BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY, "Field"); + BT_ASSERT_PRE_DEV_FIELD_IS_DYNAMIC_ARRAY(field, "Field"); BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field"); if (G_UNLIKELY(length > array_field->fields->len)) { @@ -950,7 +952,7 @@ enum bt_field_array_dynamic_set_length_status bt_field_array_dynamic_set_length( goto end; } - BT_ASSERT(!array_field->fields->pdata[i]); + BT_ASSERT_DBG(!array_field->fields->pdata[i]); array_field->fields->pdata[i] = elem_field; } } @@ -1036,7 +1038,7 @@ struct bt_field *borrow_structure_field_member_field_by_name( } ret_field = struct_field->fields->pdata[GPOINTER_TO_UINT(index)]; - BT_ASSERT(ret_field); + BT_ASSERT_DBG(ret_field); end: return ret_field; @@ -1060,8 +1062,7 @@ void bt_field_option_set_has_field(struct bt_field *field, bt_bool has_field) struct bt_field_option *opt_field = (void *) field; BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); - BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field, - BT_FIELD_CLASS_TYPE_OPTION, "Field"); + BT_ASSERT_PRE_DEV_FIELD_IS_OPTION(field, "Field"); BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field"); if (has_field) { @@ -1076,8 +1077,7 @@ struct bt_field *bt_field_option_borrow_field(struct bt_field *field) struct bt_field_option *opt_field = (void *) field; BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); - BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field, - BT_FIELD_CLASS_TYPE_OPTION, "Field"); + BT_ASSERT_PRE_DEV_FIELD_IS_OPTION(field, "Field"); return opt_field->selected_field; } @@ -1119,7 +1119,7 @@ borrow_variant_field_selected_class_option(const struct bt_field *field) const struct bt_field_class_named_field_class_container *container_fc; const struct bt_field_variant *var_field = (const void *) field; - BT_ASSERT(field); + BT_ASSERT_DBG(field); BT_ASSERT_PRE_DEV(var_field->selected_field, "Variant field has no selected field: %!+f", field); container_fc = (const void *) field->class; @@ -1127,7 +1127,7 @@ borrow_variant_field_selected_class_option(const struct bt_field *field) } const struct bt_field_class_variant_option * -bt_field_variant_borrow_selected_class_option_const( +bt_field_variant_borrow_selected_option_class_const( const struct bt_field *field) { BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); @@ -1135,32 +1135,33 @@ bt_field_variant_borrow_selected_class_option_const( return borrow_variant_field_selected_class_option(field); } -const struct bt_field_class_variant_with_selector_unsigned_option * -bt_field_variant_with_unsigned_selector_borrow_selected_class_option_const( +const struct bt_field_class_variant_with_selector_field_integer_unsigned_option * +bt_field_variant_with_selector_field_integer_unsigned_borrow_selected_option_class_const( const struct bt_field *field) { BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field, - BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_SELECTOR, "Field"); + BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD, "Field"); return (const void *) borrow_variant_field_selected_class_option(field); } -const struct bt_field_class_variant_with_selector_signed_option * -bt_field_variant_with_signed_selector_borrow_selected_class_option_const( +const struct bt_field_class_variant_with_selector_field_integer_signed_option * +bt_field_variant_with_selector_field_integer_signed_borrow_selected_option_class_const( const struct bt_field *field) { BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field, - BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_SELECTOR, "Field"); + BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_INTEGER_SELECTOR_FIELD, "Field"); return (const void *) borrow_variant_field_selected_class_option(field); } -enum bt_field_variant_select_option_field_by_index_status -bt_field_variant_select_option_field_by_index( +enum bt_field_variant_select_option_by_index_status +bt_field_variant_select_option_by_index( struct bt_field *field, uint64_t index) { struct bt_field_variant *var_field = (void *) field; + BT_ASSERT_PRE_DEV_NO_ERROR(); BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); BT_ASSERT_PRE_DEV_FIELD_IS_VARIANT(field, "Field"); BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field"); @@ -1170,7 +1171,7 @@ bt_field_variant_select_option_field_by_index( return BT_FUNC_STATUS_OK; } -uint64_t bt_field_variant_get_selected_option_field_index( +uint64_t bt_field_variant_get_selected_option_index( const struct bt_field *field) { const struct bt_field_variant *var_field = (const void *) field; @@ -1314,13 +1315,55 @@ BT_HIDDEN void bt_field_destroy(struct bt_field *field) { BT_ASSERT(field); - field_destroy_funcs[field->class->type](field); + + switch (field->class->type) { + case BT_FIELD_CLASS_TYPE_BOOL: + destroy_bool_field(field); + break; + case BT_FIELD_CLASS_TYPE_BIT_ARRAY: + destroy_bit_array_field(field); + break; + case BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER: + case BT_FIELD_CLASS_TYPE_SIGNED_INTEGER: + case BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION: + case BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION: + destroy_integer_field(field); + break; + case BT_FIELD_CLASS_TYPE_SINGLE_PRECISION_REAL: + case BT_FIELD_CLASS_TYPE_DOUBLE_PRECISION_REAL: + destroy_real_field(field); + break; + case BT_FIELD_CLASS_TYPE_STRING: + destroy_string_field(field); + break; + case BT_FIELD_CLASS_TYPE_STRUCTURE: + destroy_structure_field(field); + break; + case BT_FIELD_CLASS_TYPE_STATIC_ARRAY: + case BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITHOUT_LENGTH_FIELD: + case BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITH_LENGTH_FIELD: + destroy_array_field(field); + break; + case BT_FIELD_CLASS_TYPE_OPTION_WITHOUT_SELECTOR_FIELD: + case BT_FIELD_CLASS_TYPE_OPTION_WITH_BOOL_SELECTOR_FIELD: + case BT_FIELD_CLASS_TYPE_OPTION_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD: + case BT_FIELD_CLASS_TYPE_OPTION_WITH_SIGNED_INTEGER_SELECTOR_FIELD: + destroy_option_field(field); + break; + case BT_FIELD_CLASS_TYPE_VARIANT_WITHOUT_SELECTOR_FIELD: + case BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD: + case BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_INTEGER_SELECTOR_FIELD: + destroy_variant_field(field); + break; + default: + bt_common_abort(); + } } static void reset_single_field(struct bt_field *field) { - BT_ASSERT(field); + BT_ASSERT_DBG(field); field->is_set = false; } @@ -1330,7 +1373,7 @@ void reset_structure_field(struct bt_field *field) uint64_t i; struct bt_field_structure *struct_field = (void *) field; - BT_ASSERT(field); + BT_ASSERT_DBG(field); for (i = 0; i < struct_field->fields->len; i++) { bt_field_reset(struct_field->fields->pdata[i]); @@ -1342,7 +1385,7 @@ void reset_option_field(struct bt_field *field) { struct bt_field_option *opt_field = (void *) field; - BT_ASSERT(opt_field); + BT_ASSERT_DBG(opt_field); bt_field_reset(opt_field->content_field); opt_field->selected_field = NULL; } @@ -1353,7 +1396,7 @@ void reset_variant_field(struct bt_field *field) uint64_t i; struct bt_field_variant *var_field = (void *) field; - BT_ASSERT(field); + BT_ASSERT_DBG(field); for (i = 0; i < var_field->fields->len; i++) { bt_field_reset(var_field->fields->pdata[i]); @@ -1366,7 +1409,7 @@ void reset_array_field(struct bt_field *field) uint64_t i; struct bt_field_array *array_field = (void *) field; - BT_ASSERT(field); + BT_ASSERT_DBG(field); for (i = 0; i < array_field->fields->len; i++) { bt_field_reset(array_field->fields->pdata[i]); @@ -1457,17 +1500,17 @@ BT_HIDDEN void _bt_field_set_is_frozen(const struct bt_field *field, bool is_frozen) { - BT_ASSERT(field); + BT_ASSERT_DBG(field); BT_LIB_LOGD("Setting field object's frozen state: %!+f, is-frozen=%d", field, is_frozen); - BT_ASSERT(field->methods->set_is_frozen); + BT_ASSERT_DBG(field->methods->set_is_frozen); field->methods->set_is_frozen((void *) field, is_frozen); } static bool single_field_is_set(const struct bt_field *field) { - BT_ASSERT(field); + BT_ASSERT_DBG(field); return field->is_set; } @@ -1478,7 +1521,7 @@ bool structure_field_is_set(const struct bt_field *field) uint64_t i; const struct bt_field_structure *struct_field = (const void *) field; - BT_ASSERT(field); + BT_ASSERT_DBG(field); for (i = 0; i < struct_field->fields->len; i++) { is_set = bt_field_is_set(struct_field->fields->pdata[i]); @@ -1497,7 +1540,7 @@ bool option_field_is_set(const struct bt_field *field) const struct bt_field_option *opt_field = (const void *) field; bool is_set = false; - BT_ASSERT(field); + BT_ASSERT_DBG(field); if (opt_field->selected_field) { is_set = bt_field_is_set(opt_field->selected_field); @@ -1512,7 +1555,7 @@ bool variant_field_is_set(const struct bt_field *field) const struct bt_field_variant *var_field = (const void *) field; bool is_set = false; - BT_ASSERT(field); + BT_ASSERT_DBG(field); if (var_field->selected_field) { is_set = bt_field_is_set(var_field->selected_field); @@ -1528,7 +1571,7 @@ bool array_field_is_set(const struct bt_field *field) uint64_t i; const struct bt_field_array *array_field = (const void *) field; - BT_ASSERT(field); + BT_ASSERT_DBG(field); for (i = 0; i < array_field->length; i++) { is_set = bt_field_is_set(array_field->fields->pdata[i]);