X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Flib%2Ftrace-ir%2Ffield.c;h=9ab11aacbbc6e8884343c8d39174200b6a8a7f27;hb=7b4311c13e6c335ae193fafed8060ef5bcec635e;hp=8177c17107ad63c4e9af704efee6daf9aa542bf6;hpb=98b15851a941e7342b8bb19e265cdc3a40fabfb8;p=babeltrace.git diff --git a/src/lib/trace-ir/field.c b/src/lib/trace-ir/field.c index 8177c171..9ab11aac 100644 --- a/src/lib/trace-ir/field.c +++ b/src/lib/trace-ir/field.c @@ -33,6 +33,7 @@ #include "common/align.h" #include "common/assert.h" #include +#include #include "field.h" #include "field-class.h" @@ -271,7 +272,7 @@ struct bt_field *bt_field_create(struct bt_field_class *fc) field = create_variant_field(fc); break; default: - abort(); + bt_common_abort(); } if (!field) { @@ -796,6 +797,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)"); @@ -815,6 +817,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)"); @@ -861,6 +864,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"); @@ -874,6 +878,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)); } @@ -885,6 +891,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"); @@ -934,6 +941,7 @@ 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_IS_DYNAMIC_ARRAY(field, "Field"); BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field"); @@ -1136,7 +1144,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"); @@ -1145,7 +1153,7 @@ bt_field_variant_borrow_selected_class_option_const( } const struct bt_field_class_variant_with_selector_field_integer_unsigned_option * -bt_field_variant_with_unsigned_integer_selector_borrow_selected_class_option_const( +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"); @@ -1155,7 +1163,7 @@ bt_field_variant_with_unsigned_integer_selector_borrow_selected_class_option_con } const struct bt_field_class_variant_with_selector_field_integer_signed_option * -bt_field_variant_with_signed_integer_selector_borrow_selected_class_option_const( +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"); @@ -1164,12 +1172,13 @@ bt_field_variant_with_signed_integer_selector_borrow_selected_class_option_const 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"); @@ -1179,7 +1188,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; @@ -1364,7 +1373,7 @@ void bt_field_destroy(struct bt_field *field) destroy_variant_field(field); break; default: - abort(); + bt_common_abort(); } }