From d5b13b9b6a434797f856547be1ca6a59f70ba530 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Thu, 16 Apr 2020 13:13:11 -0400 Subject: [PATCH] lib: use common precond. assert. macros from `assert-cond.h` thru lib Signed-off-by: Philippe Proulx Change-Id: Iad421161d61079f8777c4d75232e523a59f9120c Reviewed-on: https://review.lttng.org/c/babeltrace/+/3434 --- src/lib/assert-cond.h | 4 +- src/lib/current-thread.c | 8 +- src/lib/error.c | 40 ++--- src/lib/graph/component-class.c | 94 +++++----- src/lib/graph/component-descriptor-set.c | 7 +- src/lib/graph/component-filter.c | 2 +- src/lib/graph/component-sink.c | 4 +- src/lib/graph/component-source.c | 2 +- src/lib/graph/component.c | 28 +-- src/lib/graph/connection.c | 4 +- src/lib/graph/graph.c | 41 +++-- src/lib/graph/interrupter.c | 6 +- src/lib/graph/iterator.c | 35 ++-- src/lib/graph/message-iterator-class.c | 12 +- src/lib/graph/message/discarded-items.c | 51 +++--- src/lib/graph/message/event.c | 22 ++- .../message/message-iterator-inactivity.c | 6 +- src/lib/graph/message/message.c | 2 +- src/lib/graph/message/packet.c | 29 ++-- src/lib/graph/message/stream.c | 28 ++- src/lib/graph/mip.c | 2 +- src/lib/graph/port.c | 14 +- src/lib/graph/query-executor.c | 18 +- src/lib/integer-range-set.c | 16 +- src/lib/plugin/plugin.c | 38 ++-- src/lib/trace-ir/clock-class.c | 49 +++--- src/lib/trace-ir/clock-snapshot.c | 6 +- src/lib/trace-ir/event-class.c | 57 +++--- src/lib/trace-ir/event.c | 18 +- src/lib/trace-ir/field-class.c | 163 +++++++++--------- src/lib/trace-ir/field-path.c | 6 +- src/lib/trace-ir/field.c | 120 ++++++------- src/lib/trace-ir/packet.c | 6 +- src/lib/trace-ir/stream-class.c | 94 +++++----- src/lib/trace-ir/stream.c | 31 ++-- src/lib/trace-ir/trace-class.c | 27 ++- src/lib/trace-ir/trace.c | 53 +++--- src/lib/value.c | 66 +++---- 38 files changed, 590 insertions(+), 619 deletions(-) diff --git a/src/lib/assert-cond.h b/src/lib/assert-cond.h index df39e83e..317ba23b 100644 --- a/src/lib/assert-cond.h +++ b/src/lib/assert-cond.h @@ -437,9 +437,9 @@ ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_INTEGER_SELECTOR_FIELD, \ _name " is not a variant field: %![field-]+f", (_field)) -#define BT_ASSERT_PRE_DEV_FIELD_IS_SET(_field, _name) \ +#define BT_ASSERT_PRE_DEV_FIELD_IS_SET(_field) \ BT_ASSERT_PRE_DEV(bt_field_is_set(_field), \ - _name " is not set: %!+f", (_field)) + "Field is not set: %!+f", (_field)) #define _BT_ASSERT_PRE_FIELD_NAME "Field" diff --git a/src/lib/current-thread.c b/src/lib/current-thread.c index 457ca6f1..f99eb93c 100644 --- a/src/lib/current-thread.c +++ b/src/lib/current-thread.c @@ -42,7 +42,7 @@ void bt_current_thread_clear_error(void) void bt_current_thread_move_error(const struct bt_error *error) { - BT_ASSERT_PRE_NON_NULL(error, "Error"); + BT_ASSERT_PRE_ERROR_NON_NULL(error); bt_current_thread_clear_error(); thread_error = (void *) error; BT_LOGD("Moved error object as current thread's error: addr=%p", @@ -113,7 +113,7 @@ bt_current_thread_error_append_cause_from_component( try_create_thread_error(); va_list args; - BT_ASSERT_PRE_NON_NULL(self_comp, "Component"); + BT_ASSERT_PRE_COMP_NON_NULL(self_comp); BT_ASSERT_PRE_NON_NULL(file_name, "File name"); BT_ASSERT_PRE_NON_NULL(msg_fmt, "Message format string"); @@ -141,7 +141,7 @@ bt_current_thread_error_append_cause_from_component_class( try_create_thread_error(); va_list args; - BT_ASSERT_PRE_NON_NULL(self_comp_class, "Component class"); + BT_ASSERT_PRE_COMP_CLS_NON_NULL(self_comp_class); BT_ASSERT_PRE_NON_NULL(file_name, "File name"); BT_ASSERT_PRE_NON_NULL(msg_fmt, "Message format string"); @@ -169,7 +169,7 @@ bt_current_thread_error_append_cause_from_message_iterator( try_create_thread_error(); va_list args; - BT_ASSERT_PRE_NON_NULL(self_iter, "Message iterator"); + BT_ASSERT_PRE_MSG_ITER_NON_NULL(self_iter); BT_ASSERT_PRE_NON_NULL(file_name, "File name"); BT_ASSERT_PRE_NON_NULL(msg_fmt, "Message format string"); diff --git a/src/lib/error.c b/src/lib/error.c index 1429af06..58a37498 100644 --- a/src/lib/error.c +++ b/src/lib/error.c @@ -601,20 +601,20 @@ uint64_t error_cause_count(const bt_error *error) uint64_t bt_error_get_cause_count(const bt_error *error) { - BT_ASSERT_PRE_NON_NULL(error, "Error"); + BT_ASSERT_PRE_ERROR_NON_NULL(error); return error_cause_count(error); } void bt_error_release(const struct bt_error *error) { - BT_ASSERT_PRE_NON_NULL(error, "Error"); + BT_ASSERT_PRE_ERROR_NON_NULL(error); bt_error_destroy((void *) error); } const struct bt_error_cause *bt_error_borrow_cause_by_index( const bt_error *error, uint64_t index) { - BT_ASSERT_PRE_NON_NULL(error, "Error"); + BT_ASSERT_PRE_ERROR_NON_NULL(error); BT_ASSERT_PRE_VALID_INDEX(index, error_cause_count(error)); return error->causes->pdata[index]; } @@ -622,31 +622,31 @@ const struct bt_error_cause *bt_error_borrow_cause_by_index( enum bt_error_cause_actor_type bt_error_cause_get_actor_type( const struct bt_error_cause *cause) { - BT_ASSERT_PRE_NON_NULL(cause, "Error cause"); + BT_ASSERT_PRE_ERROR_CAUSE_NON_NULL(cause); return cause->actor_type; } const char *bt_error_cause_get_message(const struct bt_error_cause *cause) { - BT_ASSERT_PRE_NON_NULL(cause, "Error cause"); + BT_ASSERT_PRE_ERROR_CAUSE_NON_NULL(cause); return cause->message->str; } const char *bt_error_cause_get_module_name(const struct bt_error_cause *cause) { - BT_ASSERT_PRE_NON_NULL(cause, "Error cause"); + BT_ASSERT_PRE_ERROR_CAUSE_NON_NULL(cause); return cause->module_name->str; } const char *bt_error_cause_get_file_name(const struct bt_error_cause *cause) { - BT_ASSERT_PRE_NON_NULL(cause, "Error cause"); + BT_ASSERT_PRE_ERROR_CAUSE_NON_NULL(cause); return cause->file_name->str; } uint64_t bt_error_cause_get_line_number(const bt_error_cause *cause) { - BT_ASSERT_PRE_NON_NULL(cause, "Error cause"); + BT_ASSERT_PRE_ERROR_CAUSE_NON_NULL(cause); return cause->line_no; } @@ -656,7 +656,7 @@ const char *bt_error_cause_component_actor_get_component_name( const struct bt_error_cause_component_actor *spec_cause = (const void *) cause; - BT_ASSERT_PRE_NON_NULL(cause, "Error cause"); + BT_ASSERT_PRE_ERROR_CAUSE_NON_NULL(cause); BT_ASSERT_PRE_CAUSE_HAS_ACTOR_TYPE(cause, BT_ERROR_CAUSE_ACTOR_TYPE_COMPONENT); return spec_cause->comp_name->str; @@ -668,7 +668,7 @@ bt_component_class_type bt_error_cause_component_actor_get_component_class_type( const struct bt_error_cause_component_actor *spec_cause = (const void *) cause; - BT_ASSERT_PRE_NON_NULL(cause, "Error cause"); + BT_ASSERT_PRE_ERROR_CAUSE_NON_NULL(cause); BT_ASSERT_PRE_CAUSE_HAS_ACTOR_TYPE(cause, BT_ERROR_CAUSE_ACTOR_TYPE_COMPONENT); return spec_cause->comp_class_id.type; @@ -680,7 +680,7 @@ const char *bt_error_cause_component_actor_get_component_class_name( const struct bt_error_cause_component_actor *spec_cause = (const void *) cause; - BT_ASSERT_PRE_NON_NULL(cause, "Error cause"); + BT_ASSERT_PRE_ERROR_CAUSE_NON_NULL(cause); BT_ASSERT_PRE_CAUSE_HAS_ACTOR_TYPE(cause, BT_ERROR_CAUSE_ACTOR_TYPE_COMPONENT); return spec_cause->comp_class_id.name->str; @@ -692,7 +692,7 @@ const char *bt_error_cause_component_actor_get_plugin_name( const struct bt_error_cause_component_actor *spec_cause = (const void *) cause; - BT_ASSERT_PRE_NON_NULL(cause, "Error cause"); + BT_ASSERT_PRE_ERROR_CAUSE_NON_NULL(cause); BT_ASSERT_PRE_CAUSE_HAS_ACTOR_TYPE(cause, BT_ERROR_CAUSE_ACTOR_TYPE_COMPONENT); return spec_cause->comp_class_id.plugin_name->len > 0 ? @@ -706,7 +706,7 @@ bt_error_cause_component_class_actor_get_component_class_type( const struct bt_error_cause_component_class_actor *spec_cause = (const void *) cause; - BT_ASSERT_PRE_NON_NULL(cause, "Error cause"); + BT_ASSERT_PRE_ERROR_CAUSE_NON_NULL(cause); BT_ASSERT_PRE_CAUSE_HAS_ACTOR_TYPE(cause, BT_ERROR_CAUSE_ACTOR_TYPE_COMPONENT_CLASS); return spec_cause->comp_class_id.type; @@ -718,7 +718,7 @@ const char *bt_error_cause_component_class_actor_get_component_class_name( const struct bt_error_cause_component_class_actor *spec_cause = (const void *) cause; - BT_ASSERT_PRE_NON_NULL(cause, "Error cause"); + BT_ASSERT_PRE_ERROR_CAUSE_NON_NULL(cause); BT_ASSERT_PRE_CAUSE_HAS_ACTOR_TYPE(cause, BT_ERROR_CAUSE_ACTOR_TYPE_COMPONENT_CLASS); return spec_cause->comp_class_id.name->str; @@ -730,7 +730,7 @@ const char *bt_error_cause_component_class_actor_get_plugin_name( const struct bt_error_cause_component_class_actor *spec_cause = (const void *) cause; - BT_ASSERT_PRE_NON_NULL(cause, "Error cause"); + BT_ASSERT_PRE_ERROR_CAUSE_NON_NULL(cause); BT_ASSERT_PRE_CAUSE_HAS_ACTOR_TYPE(cause, BT_ERROR_CAUSE_ACTOR_TYPE_COMPONENT_CLASS); return spec_cause->comp_class_id.plugin_name->len > 0 ? @@ -743,7 +743,7 @@ const char *bt_error_cause_message_iterator_actor_get_component_name( const struct bt_error_cause_message_iterator_actor *spec_cause = (const void *) cause; - BT_ASSERT_PRE_NON_NULL(cause, "Error cause"); + BT_ASSERT_PRE_ERROR_CAUSE_NON_NULL(cause); BT_ASSERT_PRE_CAUSE_HAS_ACTOR_TYPE(cause, BT_ERROR_CAUSE_ACTOR_TYPE_MESSAGE_ITERATOR); return spec_cause->comp_name->str; @@ -756,7 +756,7 @@ bt_error_cause_message_iterator_actor_get_component_output_port_name( const struct bt_error_cause_message_iterator_actor *spec_cause = (const void *) cause; - BT_ASSERT_PRE_NON_NULL(cause, "Error cause"); + BT_ASSERT_PRE_ERROR_CAUSE_NON_NULL(cause); BT_ASSERT_PRE_CAUSE_HAS_ACTOR_TYPE(cause, BT_ERROR_CAUSE_ACTOR_TYPE_MESSAGE_ITERATOR); return spec_cause->output_port_name->str; @@ -769,7 +769,7 @@ bt_error_cause_message_iterator_actor_get_component_class_type( const struct bt_error_cause_message_iterator_actor *spec_cause = (const void *) cause; - BT_ASSERT_PRE_NON_NULL(cause, "Error cause"); + BT_ASSERT_PRE_ERROR_CAUSE_NON_NULL(cause); BT_ASSERT_PRE_CAUSE_HAS_ACTOR_TYPE(cause, BT_ERROR_CAUSE_ACTOR_TYPE_MESSAGE_ITERATOR); return spec_cause->comp_class_id.type; @@ -781,7 +781,7 @@ const char *bt_error_cause_message_iterator_actor_get_component_class_name( const struct bt_error_cause_message_iterator_actor *spec_cause = (const void *) cause; - BT_ASSERT_PRE_NON_NULL(cause, "Error cause"); + BT_ASSERT_PRE_ERROR_CAUSE_NON_NULL(cause); BT_ASSERT_PRE_CAUSE_HAS_ACTOR_TYPE(cause, BT_ERROR_CAUSE_ACTOR_TYPE_MESSAGE_ITERATOR); return spec_cause->comp_class_id.name->str; @@ -793,7 +793,7 @@ const char *bt_error_cause_message_iterator_actor_get_plugin_name( const struct bt_error_cause_message_iterator_actor *spec_cause = (const void *) cause; - BT_ASSERT_PRE_NON_NULL(cause, "Error cause"); + BT_ASSERT_PRE_ERROR_CAUSE_NON_NULL(cause); BT_ASSERT_PRE_CAUSE_HAS_ACTOR_TYPE(cause, BT_ERROR_CAUSE_ACTOR_TYPE_MESSAGE_ITERATOR); return spec_cause->comp_class_id.plugin_name->len > 0 ? diff --git a/src/lib/graph/component-class.c b/src/lib/graph/component-class.c index 79de19fb..7f31aa30 100644 --- a/src/lib/graph/component-class.c +++ b/src/lib/graph/component-class.c @@ -19,7 +19,7 @@ #include "lib/func-status.h" #include "lib/graph/message-iterator-class.h" -#define BT_ASSERT_PRE_DEV_COMP_CLS_HOT(_cc) \ +#define BT_ASSERT_PRE_DEV_COMP_CLS_HOT(_cc) \ BT_ASSERT_PRE_DEV_HOT(((const struct bt_component_class *) (_cc)), \ "Component class", ": %!+C", (_cc)) @@ -161,8 +161,8 @@ struct bt_component_class_source *bt_component_class_source_create( int ret; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(name, "Name"); - BT_ASSERT_PRE_NON_NULL(message_iterator_class, "Message iterator class"); + BT_ASSERT_PRE_NAME_NON_NULL(name); + BT_ASSERT_PRE_MSG_ITER_CLS_NON_NULL(message_iterator_class); BT_LIB_LOGI("Creating source component class: " "name=\"%s\", %![msg-iter-cls-]+I", name, message_iterator_class); @@ -200,8 +200,8 @@ struct bt_component_class_filter *bt_component_class_filter_create( int ret; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(name, "Name"); - BT_ASSERT_PRE_NON_NULL(message_iterator_class, "Message iterator class"); + BT_ASSERT_PRE_NAME_NON_NULL(name); + BT_ASSERT_PRE_MSG_ITER_CLS_NON_NULL(message_iterator_class); BT_LIB_LOGI("Creating filter component class: " "name=\"%s\", %![msg-iter-cls-]+I", name, message_iterator_class); @@ -238,7 +238,7 @@ struct bt_component_class_sink *bt_component_class_sink_create( int ret; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(name, "Name"); + BT_ASSERT_PRE_NAME_NON_NULL(name); BT_ASSERT_PRE_NON_NULL(method, "Consume next method"); BT_LOGI("Creating sink component class: " "name=\"%s\", consume-method-addr=%p", @@ -276,8 +276,8 @@ bt_component_class_source_set_get_supported_mip_versions_method( bt_component_class_source_get_supported_mip_versions_method method) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class"); - BT_ASSERT_PRE_NON_NULL(method, "Method"); + BT_ASSERT_PRE_COMP_CLS_NON_NULL(comp_cls); + BT_ASSERT_PRE_METHOD_NON_NULL(method); BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls); comp_cls->methods.get_supported_mip_versions = method; BT_LIB_LOGD("Set source component class's \"get supported MIP versions\" method: " @@ -291,8 +291,8 @@ bt_component_class_filter_set_get_supported_mip_versions_method( bt_component_class_filter_get_supported_mip_versions_method method) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class"); - BT_ASSERT_PRE_NON_NULL(method, "Method"); + BT_ASSERT_PRE_COMP_CLS_NON_NULL(comp_cls); + BT_ASSERT_PRE_METHOD_NON_NULL(method); BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls); comp_cls->methods.get_supported_mip_versions = method; BT_LIB_LOGD("Set filter component class's \"get supported MIP versions\" method: " @@ -306,8 +306,8 @@ bt_component_class_sink_set_get_supported_mip_versions_method( bt_component_class_sink_get_supported_mip_versions_method method) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class"); - BT_ASSERT_PRE_NON_NULL(method, "Method"); + BT_ASSERT_PRE_COMP_CLS_NON_NULL(comp_cls); + BT_ASSERT_PRE_METHOD_NON_NULL(method); BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls); comp_cls->methods.get_supported_mip_versions = method; BT_LIB_LOGD("Set sink component class's \"get supported MIP versions\" method: " @@ -321,8 +321,8 @@ bt_component_class_source_set_initialize_method( bt_component_class_source_initialize_method method) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class"); - BT_ASSERT_PRE_NON_NULL(method, "Method"); + BT_ASSERT_PRE_COMP_CLS_NON_NULL(comp_cls); + BT_ASSERT_PRE_METHOD_NON_NULL(method); BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls); comp_cls->methods.init = method; BT_LIB_LOGD("Set source component class's initialization method: " @@ -336,8 +336,8 @@ bt_component_class_filter_set_initialize_method( bt_component_class_filter_initialize_method method) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class"); - BT_ASSERT_PRE_NON_NULL(method, "Method"); + BT_ASSERT_PRE_COMP_CLS_NON_NULL(comp_cls); + BT_ASSERT_PRE_METHOD_NON_NULL(method); BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls); comp_cls->methods.init = method; BT_LIB_LOGD("Set filter component class's initialization method: " @@ -351,8 +351,8 @@ bt_component_class_sink_set_initialize_method( bt_component_class_sink_initialize_method method) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class"); - BT_ASSERT_PRE_NON_NULL(method, "Method"); + BT_ASSERT_PRE_COMP_CLS_NON_NULL(comp_cls); + BT_ASSERT_PRE_METHOD_NON_NULL(method); BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls); comp_cls->methods.init = method; BT_LIB_LOGD("Set sink component class's initialization method: " @@ -366,8 +366,8 @@ bt_component_class_source_set_finalize_method( bt_component_class_source_finalize_method method) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class"); - BT_ASSERT_PRE_NON_NULL(method, "Method"); + BT_ASSERT_PRE_COMP_CLS_NON_NULL(comp_cls); + BT_ASSERT_PRE_METHOD_NON_NULL(method); BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls); comp_cls->methods.finalize = method; BT_LIB_LOGD("Set source component class's finalization method: " @@ -381,8 +381,8 @@ bt_component_class_filter_set_finalize_method( bt_component_class_filter_finalize_method method) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class"); - BT_ASSERT_PRE_NON_NULL(method, "Method"); + BT_ASSERT_PRE_COMP_CLS_NON_NULL(comp_cls); + BT_ASSERT_PRE_METHOD_NON_NULL(method); BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls); comp_cls->methods.finalize = method; BT_LIB_LOGD("Set filter component class's finalization method: " @@ -396,8 +396,8 @@ bt_component_class_sink_set_finalize_method( bt_component_class_sink_finalize_method method) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class"); - BT_ASSERT_PRE_NON_NULL(method, "Method"); + BT_ASSERT_PRE_COMP_CLS_NON_NULL(comp_cls); + BT_ASSERT_PRE_METHOD_NON_NULL(method); BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls); comp_cls->methods.finalize = method; BT_LIB_LOGD("Set sink component class's finalization method: " @@ -411,8 +411,8 @@ bt_component_class_source_set_query_method( bt_component_class_source_query_method method) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class"); - BT_ASSERT_PRE_NON_NULL(method, "Method"); + BT_ASSERT_PRE_COMP_CLS_NON_NULL(comp_cls); + BT_ASSERT_PRE_METHOD_NON_NULL(method); BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls); comp_cls->methods.query = method; BT_LIB_LOGD("Set source component class's query method: " @@ -426,8 +426,8 @@ bt_component_class_filter_set_query_method( bt_component_class_filter_query_method method) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class"); - BT_ASSERT_PRE_NON_NULL(method, "Method"); + BT_ASSERT_PRE_COMP_CLS_NON_NULL(comp_cls); + BT_ASSERT_PRE_METHOD_NON_NULL(method); BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls); comp_cls->methods.query = method; BT_LIB_LOGD("Set filter component class's query method: " @@ -441,8 +441,8 @@ bt_component_class_sink_set_query_method( bt_component_class_sink_query_method method) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class"); - BT_ASSERT_PRE_NON_NULL(method, "Method"); + BT_ASSERT_PRE_COMP_CLS_NON_NULL(comp_cls); + BT_ASSERT_PRE_METHOD_NON_NULL(method); BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls); comp_cls->methods.query = method; BT_LIB_LOGD("Set sink component class's query method: " @@ -456,8 +456,8 @@ bt_component_class_filter_set_input_port_connected_method( bt_component_class_filter_input_port_connected_method method) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class"); - BT_ASSERT_PRE_NON_NULL(method, "Method"); + BT_ASSERT_PRE_COMP_CLS_NON_NULL(comp_cls); + BT_ASSERT_PRE_METHOD_NON_NULL(method); BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls); comp_cls->methods.input_port_connected = method; BT_LIB_LOGD("Set filter component class's \"input port connected\" method" @@ -471,8 +471,8 @@ bt_component_class_sink_set_input_port_connected_method( bt_component_class_sink_input_port_connected_method method) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class"); - BT_ASSERT_PRE_NON_NULL(method, "Method"); + BT_ASSERT_PRE_COMP_CLS_NON_NULL(comp_cls); + BT_ASSERT_PRE_METHOD_NON_NULL(method); BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls); comp_cls->methods.input_port_connected = method; BT_LIB_LOGD("Set sink component class's \"input port connected\" method" @@ -486,8 +486,8 @@ bt_component_class_source_set_output_port_connected_method( bt_component_class_source_output_port_connected_method method) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class"); - BT_ASSERT_PRE_NON_NULL(method, "Method"); + BT_ASSERT_PRE_COMP_CLS_NON_NULL(comp_cls); + BT_ASSERT_PRE_METHOD_NON_NULL(method); BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls); comp_cls->methods.output_port_connected = method; BT_LIB_LOGD("Set source component class's \"output port connected\" method" @@ -501,8 +501,8 @@ bt_component_class_filter_set_output_port_connected_method( bt_component_class_filter_output_port_connected_method method) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class"); - BT_ASSERT_PRE_NON_NULL(method, "Method"); + BT_ASSERT_PRE_COMP_CLS_NON_NULL(comp_cls); + BT_ASSERT_PRE_METHOD_NON_NULL(method); BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls); comp_cls->methods.output_port_connected = method; BT_LIB_LOGD("Set filter component class's \"output port connected\" method" @@ -516,8 +516,8 @@ bt_component_class_sink_set_graph_is_configured_method( bt_component_class_sink_graph_is_configured_method method) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class"); - BT_ASSERT_PRE_NON_NULL(method, "Method"); + BT_ASSERT_PRE_COMP_CLS_NON_NULL(comp_cls); + BT_ASSERT_PRE_METHOD_NON_NULL(method); BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls); comp_cls->methods.graph_is_configured = method; BT_LIB_LOGD("Set sink component class's \"graph is configured\" method" @@ -531,8 +531,8 @@ bt_component_class_set_description( const char *description) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class"); - BT_ASSERT_PRE_NON_NULL(description, "Description"); + BT_ASSERT_PRE_COMP_CLS_NON_NULL(comp_cls); + BT_ASSERT_PRE_DESCR_NON_NULL(description); BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls); g_string_assign(comp_cls->description, description); BT_LIB_LOGD("Set component class's description: " @@ -548,7 +548,7 @@ enum bt_component_class_set_help_status bt_component_class_set_help( const char *help) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class"); + BT_ASSERT_PRE_COMP_CLS_NON_NULL(comp_cls); BT_ASSERT_PRE_NON_NULL(help, "Help"); BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls); g_string_assign(comp_cls->help, help); @@ -558,21 +558,21 @@ enum bt_component_class_set_help_status bt_component_class_set_help( const char *bt_component_class_get_name(const struct bt_component_class *comp_cls) { - BT_ASSERT_PRE_DEV_NON_NULL(comp_cls, "Component class"); + BT_ASSERT_PRE_DEV_COMP_CLS_NON_NULL(comp_cls); return comp_cls->name->str; } enum bt_component_class_type bt_component_class_get_type( const struct bt_component_class *comp_cls) { - BT_ASSERT_PRE_DEV_NON_NULL(comp_cls, "Component class"); + BT_ASSERT_PRE_DEV_COMP_CLS_NON_NULL(comp_cls); return comp_cls->type; } const char *bt_component_class_get_description( const struct bt_component_class *comp_cls) { - BT_ASSERT_PRE_DEV_NON_NULL(comp_cls, "Component class"); + BT_ASSERT_PRE_DEV_COMP_CLS_NON_NULL(comp_cls); return comp_cls->description && comp_cls->description->str[0] != '\0' ? comp_cls->description->str : NULL; @@ -581,7 +581,7 @@ const char *bt_component_class_get_description( const char *bt_component_class_get_help( const struct bt_component_class *comp_cls) { - BT_ASSERT_PRE_DEV_NON_NULL(comp_cls, "Component class"); + BT_ASSERT_PRE_DEV_COMP_CLS_NON_NULL(comp_cls); return comp_cls->help && comp_cls->help->str[0] != '\0' ? comp_cls->help->str : NULL; } diff --git a/src/lib/graph/component-descriptor-set.c b/src/lib/graph/component-descriptor-set.c index 23ed60ce..0ef24388 100644 --- a/src/lib/graph/component-descriptor-set.c +++ b/src/lib/graph/component-descriptor-set.c @@ -126,10 +126,9 @@ bt_component_descriptor_set_add_descriptor_with_initialize_method_data( GPtrArray *comp_descr_array = NULL; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(comp_descr_set, "Component descriptor set"); - BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class"); - BT_ASSERT_PRE(!params || bt_value_is_map(params), - "Parameter value is not a map value: %!+v", params); + BT_ASSERT_PRE_COMP_DESCR_SET_NON_NULL(comp_descr_set); + BT_ASSERT_PRE_COMP_CLS_NON_NULL(comp_cls); + BT_ASSERT_PRE_PARAM_VALUE_IS_MAP(params); BT_LIB_LOGI("Adding component descriptor to set: " "set-addr=%p, %![cc-]+C, " "%![params-]+v, init-method-data-addr=%p", diff --git a/src/lib/graph/component-filter.c b/src/lib/graph/component-filter.c index 24be2277..6582b8de 100644 --- a/src/lib/graph/component-filter.c +++ b/src/lib/graph/component-filter.c @@ -51,7 +51,7 @@ bt_component_filter_borrow_class_const( { struct bt_component_class *cls; - BT_ASSERT_PRE_DEV_NON_NULL(component, "Component"); + BT_ASSERT_PRE_DEV_COMP_NON_NULL(component); cls = component->parent.class; diff --git a/src/lib/graph/component-sink.c b/src/lib/graph/component-sink.c index d89b7283..d9d33cc9 100644 --- a/src/lib/graph/component-sink.c +++ b/src/lib/graph/component-sink.c @@ -51,7 +51,7 @@ bt_component_sink_borrow_class_const( { struct bt_component_class *cls; - BT_ASSERT_PRE_DEV_NON_NULL(component, "Component"); + BT_ASSERT_PRE_DEV_COMP_NON_NULL(component); cls = component->parent.class; @@ -135,7 +135,7 @@ bt_bool bt_self_component_sink_is_interrupted( { struct bt_component *comp = (void *) self_comp; - BT_ASSERT_PRE_NON_NULL(comp, "Component"); + BT_ASSERT_PRE_COMP_NON_NULL(comp); return (bt_bool) bt_graph_is_interrupted( bt_component_borrow_graph(comp)); } diff --git a/src/lib/graph/component-source.c b/src/lib/graph/component-source.c index 9e2211e1..c1638fd3 100644 --- a/src/lib/graph/component-source.c +++ b/src/lib/graph/component-source.c @@ -51,7 +51,7 @@ bt_component_source_borrow_class_const( { struct bt_component_class *cls; - BT_ASSERT_PRE_DEV_NON_NULL(component, "Component"); + BT_ASSERT_PRE_DEV_COMP_NON_NULL(component); cls = component->parent.class; diff --git a/src/lib/graph/component.c b/src/lib/graph/component.c index 7660425c..d4d01f08 100644 --- a/src/lib/graph/component.c +++ b/src/lib/graph/component.c @@ -179,7 +179,7 @@ void destroy_component(struct bt_object *obj) enum bt_component_class_type bt_component_get_class_type( const struct bt_component *component) { - BT_ASSERT_PRE_DEV_NON_NULL(component, "Component"); + BT_ASSERT_PRE_DEV_COMP_NON_NULL(component); return component->class->type; } @@ -193,8 +193,8 @@ enum bt_self_component_add_port_status add_port( struct bt_graph *graph = NULL; enum bt_self_component_add_port_status status; - BT_ASSERT_PRE_NON_NULL(component, "Component"); - BT_ASSERT_PRE_NON_NULL(name, "Name"); + BT_ASSERT_PRE_COMP_NON_NULL(component); + BT_ASSERT_PRE_NAME_NON_NULL(name); BT_ASSERT_PRE(strlen(name) > 0, "Name is empty"); graph = bt_component_borrow_graph(component); BT_ASSERT_PRE( @@ -259,14 +259,14 @@ end: BT_HIDDEN uint64_t bt_component_get_input_port_count(const struct bt_component *comp) { - BT_ASSERT_PRE_DEV_NON_NULL(comp, "Component"); + BT_ASSERT_PRE_DEV_COMP_NON_NULL(comp); return (uint64_t) comp->input_ports->len; } BT_HIDDEN uint64_t bt_component_get_output_port_count(const struct bt_component *comp) { - BT_ASSERT_PRE_DEV_NON_NULL(comp, "Component"); + BT_ASSERT_PRE_DEV_COMP_NON_NULL(comp); return (uint64_t) comp->output_ports->len; } @@ -341,14 +341,14 @@ end: const char *bt_component_get_name(const struct bt_component *component) { - BT_ASSERT_PRE_DEV_NON_NULL(component, "Component"); + BT_ASSERT_PRE_DEV_COMP_NON_NULL(component); return component->name->str; } const struct bt_component_class *bt_component_borrow_class_const( const struct bt_component *component) { - BT_ASSERT_PRE_DEV_NON_NULL(component, "Component"); + BT_ASSERT_PRE_DEV_COMP_NON_NULL(component); return component->class; } @@ -356,7 +356,7 @@ void *bt_self_component_get_data(const struct bt_self_component *self_comp) { struct bt_component *component = (void *) self_comp; - BT_ASSERT_PRE_DEV_NON_NULL(component, "Component"); + BT_ASSERT_PRE_DEV_COMP_NON_NULL(component); return component->user_data; } @@ -365,7 +365,7 @@ void bt_self_component_set_data(struct bt_self_component *self_comp, { struct bt_component *component = (void *) self_comp; - BT_ASSERT_PRE_DEV_NON_NULL(component, "Component"); + BT_ASSERT_PRE_DEV_COMP_NON_NULL(component); component->user_data = data; BT_LIB_LOGD("Set component's user data: %!+c", component); } @@ -411,7 +411,7 @@ BT_HIDDEN struct bt_port_output *bt_component_borrow_output_port_by_name( struct bt_component *comp, const char *name) { - BT_ASSERT_PRE_DEV_NON_NULL(comp, "Component"); + BT_ASSERT_PRE_DEV_COMP_NON_NULL(comp); return (void *) borrow_port_by_name(comp->output_ports, name); } @@ -427,7 +427,7 @@ BT_HIDDEN struct bt_port_input *bt_component_borrow_input_port_by_index( struct bt_component *comp, uint64_t index) { - BT_ASSERT_PRE_DEV_NON_NULL(comp, "Component"); + BT_ASSERT_PRE_DEV_COMP_NON_NULL(comp); BT_ASSERT_PRE_DEV_VALID_INDEX(index, comp->input_ports->len); return (void *) borrow_port_by_index(comp->input_ports, index); @@ -437,7 +437,7 @@ BT_HIDDEN struct bt_port_output *bt_component_borrow_output_port_by_index( struct bt_component *comp, uint64_t index) { - BT_ASSERT_PRE_DEV_NON_NULL(comp, "Component"); + BT_ASSERT_PRE_DEV_COMP_NON_NULL(comp); BT_ASSERT_PRE_DEV_VALID_INDEX(index, comp->output_ports->len); return (void *) borrow_port_by_index(comp->output_ports, index); @@ -612,7 +612,7 @@ void bt_component_remove_destroy_listener(struct bt_component *component, bt_logging_level bt_component_get_logging_level( const struct bt_component *component) { - BT_ASSERT_PRE_DEV_NON_NULL(component, "Component"); + BT_ASSERT_PRE_DEV_COMP_NON_NULL(component); return component->log_level; } @@ -621,7 +621,7 @@ uint64_t bt_self_component_get_graph_mip_version( { struct bt_component *comp = (void *) self_component; - BT_ASSERT_PRE_NON_NULL(self_component, "Component"); + BT_ASSERT_PRE_COMP_NON_NULL(self_component); return bt_component_borrow_graph(comp)->mip_version; } diff --git a/src/lib/graph/connection.c b/src/lib/graph/connection.c index c470994e..eb84c11b 100644 --- a/src/lib/graph/connection.c +++ b/src/lib/graph/connection.c @@ -215,14 +215,14 @@ void bt_connection_end(struct bt_connection *conn, bool try_remove_from_graph) const struct bt_port_output *bt_connection_borrow_upstream_port_const( const struct bt_connection *connection) { - BT_ASSERT_PRE_DEV_NON_NULL(connection, "Connection"); + BT_ASSERT_PRE_DEV_CONN_NON_NULL(connection); return (void *) connection->upstream_port; } const struct bt_port_input *bt_connection_borrow_downstream_port_const( const struct bt_connection *connection) { - BT_ASSERT_PRE_DEV_NON_NULL(connection, "Connection"); + BT_ASSERT_PRE_DEV_CONN_NON_NULL(connection); return (void *) connection->downstream_port; } diff --git a/src/lib/graph/graph.c b/src/lib/graph/graph.c index c3980d6d..f40c6104 100644 --- a/src/lib/graph/graph.c +++ b/src/lib/graph/graph.c @@ -312,7 +312,7 @@ enum bt_graph_connect_ports_status bt_graph_connect_ports( bool init_can_consume; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(graph, "Graph"); + BT_ASSERT_PRE_GRAPH_NON_NULL(graph); BT_ASSERT_PRE_NON_NULL(upstream_port, "Upstream port"); BT_ASSERT_PRE_NON_NULL(downstream_port, "Downstream port port"); BT_ASSERT_PRE( @@ -634,7 +634,7 @@ enum bt_graph_run_once_status bt_graph_run_once(struct bt_graph *graph) enum bt_graph_run_once_status status; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_DEV_NON_NULL(graph, "Graph"); + BT_ASSERT_PRE_DEV_GRAPH_NON_NULL(graph); BT_ASSERT_PRE_DEV(graph->can_consume, "Cannot consume graph in its current state: %!+g", graph); BT_ASSERT_PRE_DEV(graph->config_state != @@ -659,7 +659,7 @@ enum bt_graph_run_status bt_graph_run(struct bt_graph *graph) enum bt_graph_run_status status; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(graph, "Graph"); + BT_ASSERT_PRE_GRAPH_NON_NULL(graph); BT_ASSERT_PRE(graph->can_consume, "Cannot consume graph in its current state: %!+g", graph); BT_ASSERT_PRE(graph->config_state != BT_GRAPH_CONFIGURATION_STATE_FAULTY, @@ -737,8 +737,8 @@ bt_graph_add_source_component_output_port_added_listener( bt_listener_id listener_id; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(graph, "Graph"); - BT_ASSERT_PRE_NON_NULL(func, "Listener"); + BT_ASSERT_PRE_GRAPH_NON_NULL(graph); + BT_ASSERT_PRE_LISTENER_FUNC_NON_NULL(func); g_array_append_val(graph->listeners.source_output_port_added, listener); listener_id = graph->listeners.source_output_port_added->len - 1; BT_LIB_LOGD("Added \"source component output port added\" listener to graph: " @@ -765,8 +765,8 @@ bt_graph_add_filter_component_output_port_added_listener( bt_listener_id listener_id; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(graph, "Graph"); - BT_ASSERT_PRE_NON_NULL(func, "Listener"); + BT_ASSERT_PRE_GRAPH_NON_NULL(graph); + BT_ASSERT_PRE_LISTENER_FUNC_NON_NULL(func); g_array_append_val(graph->listeners.filter_output_port_added, listener); listener_id = graph->listeners.filter_output_port_added->len - 1; BT_LIB_LOGD("Added \"filter component output port added\" listener to graph: " @@ -793,8 +793,8 @@ bt_graph_add_filter_component_input_port_added_listener( bt_listener_id listener_id; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(graph, "Graph"); - BT_ASSERT_PRE_NON_NULL(func, "Listener"); + BT_ASSERT_PRE_GRAPH_NON_NULL(graph); + BT_ASSERT_PRE_LISTENER_FUNC_NON_NULL(func); g_array_append_val(graph->listeners.filter_input_port_added, listener); listener_id = graph->listeners.filter_input_port_added->len - 1; BT_LIB_LOGD("Added \"filter component input port added\" listener to graph: " @@ -821,8 +821,8 @@ bt_graph_add_sink_component_input_port_added_listener( bt_listener_id listener_id; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(graph, "Graph"); - BT_ASSERT_PRE_NON_NULL(func, "Listener"); + BT_ASSERT_PRE_GRAPH_NON_NULL(graph); + BT_ASSERT_PRE_LISTENER_FUNC_NON_NULL(func); g_array_append_val(graph->listeners.sink_input_port_added, listener); listener_id = graph->listeners.sink_input_port_added->len - 1; BT_LIB_LOGD("Added \"sink component input port added\" listener to graph: " @@ -964,15 +964,14 @@ int add_component_with_init_method_data( struct bt_value *new_params = NULL; BT_ASSERT(comp_cls); - BT_ASSERT_PRE_NON_NULL(graph, "Graph"); - BT_ASSERT_PRE_NON_NULL(name, "Name"); + BT_ASSERT_PRE_GRAPH_NON_NULL(graph); + BT_ASSERT_PRE_NAME_NON_NULL(name); BT_ASSERT_PRE( graph->config_state == BT_GRAPH_CONFIGURATION_STATE_CONFIGURING, "Graph is not in the \"configuring\" state: %!+g", graph); BT_ASSERT_PRE(!component_name_exists(graph, name), "Duplicate component name: %!+g, name=\"%s\"", graph, name); - BT_ASSERT_PRE(!params || bt_value_is_map(params), - "Parameter value is not a map value: %!+v", params); + BT_ASSERT_PRE_PARAM_VALUE_IS_MAP(params); init_can_consume = graph->can_consume; bt_graph_set_can_consume(graph, false); BT_LIB_LOGI("Adding component to graph: " @@ -1093,7 +1092,7 @@ bt_graph_add_source_component_with_initialize_method_data( const struct bt_component_source **component) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class"); + BT_ASSERT_PRE_COMP_CLS_NON_NULL(comp_cls); return add_component_with_init_method_data(graph, (void *) comp_cls, (comp_init_method_t) comp_cls->methods.init, name, params, init_method_data, log_level, (void *) component); @@ -1120,7 +1119,7 @@ bt_graph_add_filter_component_with_initialize_method_data( const struct bt_component_filter **component) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class"); + BT_ASSERT_PRE_COMP_CLS_NON_NULL(comp_cls); return add_component_with_init_method_data(graph, (void *) comp_cls, (comp_init_method_t) comp_cls->methods.init, name, params, init_method_data, log_level, (void *) component); @@ -1147,7 +1146,7 @@ bt_graph_add_sink_component_with_initialize_method_data( const struct bt_component_sink **component) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class"); + BT_ASSERT_PRE_COMP_CLS_NON_NULL(comp_cls); return add_component_with_init_method_data(graph, (void *) comp_cls, (comp_init_method_t) comp_cls->methods.init, name, params, init_method_data, log_level, (void *) component); @@ -1234,8 +1233,8 @@ enum bt_graph_add_interrupter_status bt_graph_add_interrupter( struct bt_graph *graph, const struct bt_interrupter *intr) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(graph, "Graph"); - BT_ASSERT_PRE_NON_NULL(intr, "Interrupter"); + BT_ASSERT_PRE_GRAPH_NON_NULL(graph); + BT_ASSERT_PRE_INTR_NON_NULL(intr); g_ptr_array_add(graph->interrupters, (void *) intr); bt_object_get_ref_no_null_check(intr); BT_LIB_LOGD("Added interrupter to graph: %![graph-]+g, %![intr-]+z", @@ -1245,7 +1244,7 @@ enum bt_graph_add_interrupter_status bt_graph_add_interrupter( struct bt_interrupter *bt_graph_borrow_default_interrupter(bt_graph *graph) { - BT_ASSERT_PRE_NON_NULL(graph, "Graph"); + BT_ASSERT_PRE_GRAPH_NON_NULL(graph); return graph->default_interrupter; } diff --git a/src/lib/graph/interrupter.c b/src/lib/graph/interrupter.c index a7e2c0d1..75237d3b 100644 --- a/src/lib/graph/interrupter.c +++ b/src/lib/graph/interrupter.c @@ -43,19 +43,19 @@ end: void bt_interrupter_set(struct bt_interrupter *intr) { - BT_ASSERT_PRE_NON_NULL(intr, "Interrupter"); + BT_ASSERT_PRE_INTR_NON_NULL(intr); intr->is_set = true; } void bt_interrupter_reset(struct bt_interrupter *intr) { - BT_ASSERT_PRE_NON_NULL(intr, "Interrupter"); + BT_ASSERT_PRE_INTR_NON_NULL(intr); intr->is_set = false; } bt_bool bt_interrupter_is_set(const struct bt_interrupter *intr) { - BT_ASSERT_PRE_NON_NULL(intr, "Interrupter"); + BT_ASSERT_PRE_INTR_NON_NULL(intr); return (bt_bool) intr->is_set; } diff --git a/src/lib/graph/iterator.c b/src/lib/graph/iterator.c index d8478553..ff5073ad 100644 --- a/src/lib/graph/iterator.c +++ b/src/lib/graph/iterator.c @@ -60,7 +60,7 @@ #define BT_ASSERT_PRE_ITER_HAS_STATE_TO_SEEK(_iter) \ BT_ASSERT_PRE((_iter)->state == BT_MESSAGE_ITERATOR_STATE_ACTIVE || \ - (_iter)->state == BT_MESSAGE_ITERATOR_STATE_ENDED || \ + (_iter)->state == BT_MESSAGE_ITERATOR_STATE_ENDED || \ (_iter)->state == BT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_AGAIN || \ (_iter)->state == BT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_ERROR, \ "Message iterator is in the wrong state: %!+i", _iter) @@ -288,7 +288,8 @@ int create_self_component_input_port_message_iterator( struct bt_component_class_with_iterator_class *upstream_comp_cls_with_iter_cls; int status; - BT_ASSERT_PRE_NON_NULL(message_iterator, "Created message iterator"); + BT_ASSERT_PRE_NON_NULL(message_iterator, + "Created message iterator (output)"); BT_ASSERT_PRE_NON_NULL(port, "Input port"); comp = bt_port_borrow_component_inline(port); BT_ASSERT_PRE(bt_port_is_connected(port), @@ -455,7 +456,7 @@ bt_message_iterator_create_from_message_iterator( struct bt_message_iterator **message_iterator) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(self_msg_iter, "Message iterator"); + BT_ASSERT_PRE_MSG_ITER_NON_NULL(self_msg_iter); return create_self_component_input_port_message_iterator(self_msg_iter, input_port, message_iterator); } @@ -478,7 +479,7 @@ void *bt_self_message_iterator_get_data( struct bt_message_iterator *iterator = (void *) self_iterator; - BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator"); + BT_ASSERT_PRE_DEV_MSG_ITER_NON_NULL(iterator); return iterator->user_data; } @@ -488,7 +489,7 @@ void bt_self_message_iterator_set_data( struct bt_message_iterator *iterator = (void *) self_iterator; - BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator"); + BT_ASSERT_PRE_DEV_MSG_ITER_NON_NULL(iterator); iterator->user_data = data; BT_LIB_LOGD("Set message iterator's user data: " "%!+i, user-data-addr=%p", iterator, data); @@ -812,7 +813,7 @@ bt_message_iterator_next( enum bt_message_iterator_next_status status = BT_FUNC_STATUS_OK; BT_ASSERT_PRE_DEV_NO_ERROR(); - BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator"); + BT_ASSERT_PRE_DEV_MSG_ITER_NON_NULL(iterator); BT_ASSERT_PRE_DEV_NON_NULL(msgs, "Message array (output)"); BT_ASSERT_PRE_DEV_NON_NULL(user_count, "Message count (output)"); BT_ASSERT_PRE_DEV(iterator->state == @@ -887,7 +888,7 @@ struct bt_component * bt_message_iterator_borrow_component( struct bt_message_iterator *iterator) { - BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator"); + BT_ASSERT_PRE_DEV_MSG_ITER_NON_NULL(iterator); return iterator->upstream_component; } @@ -897,7 +898,7 @@ struct bt_self_component *bt_self_message_iterator_borrow_component( struct bt_message_iterator *iterator = (void *) self_iterator; - BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator"); + BT_ASSERT_PRE_DEV_MSG_ITER_NON_NULL(iterator); return (void *) iterator->upstream_component; } @@ -907,7 +908,7 @@ struct bt_self_component_port_output *bt_self_message_iterator_borrow_port( struct bt_message_iterator *iterator = (void *) self_iterator; - BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator"); + BT_ASSERT_PRE_DEV_MSG_ITER_NON_NULL(iterator); return (void *) iterator->upstream_port; } @@ -919,8 +920,8 @@ bt_message_iterator_can_seek_ns_from_origin( enum bt_message_iterator_can_seek_ns_from_origin_status status; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator"); - BT_ASSERT_PRE_NON_NULL(can_seek, "Result (output)"); + BT_ASSERT_PRE_MSG_ITER_NON_NULL(iterator); + BT_ASSERT_PRE_RES_OUT_NON_NULL(can_seek); BT_ASSERT_PRE_ITER_HAS_STATE_TO_SEEK(iterator); BT_ASSERT_PRE( bt_component_borrow_graph(iterator->upstream_component)->config_state != @@ -990,8 +991,8 @@ bt_message_iterator_can_seek_beginning( enum bt_message_iterator_can_seek_beginning_status status; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator"); - BT_ASSERT_PRE_NON_NULL(can_seek, "Result (output)"); + BT_ASSERT_PRE_MSG_ITER_NON_NULL(iterator); + BT_ASSERT_PRE_RES_OUT_NON_NULL(can_seek); BT_ASSERT_PRE_ITER_HAS_STATE_TO_SEEK(iterator); BT_ASSERT_PRE( bt_component_borrow_graph(iterator->upstream_component)->config_state != @@ -1083,7 +1084,7 @@ bt_message_iterator_seek_beginning( int status; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator"); + BT_ASSERT_PRE_MSG_ITER_NON_NULL(iterator); BT_ASSERT_PRE_ITER_HAS_STATE_TO_SEEK(iterator); BT_ASSERT_PRE( bt_component_borrow_graph(iterator->upstream_component)->config_state != @@ -1127,7 +1128,7 @@ bt_bool bt_message_iterator_can_seek_forward( bt_message_iterator *iterator) { - BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator"); + BT_ASSERT_PRE_MSG_ITER_NON_NULL(iterator); return iterator->config.can_seek_forward; } @@ -1648,7 +1649,7 @@ bt_message_iterator_seek_ns_from_origin( bt_bool can_seek_by_itself; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator"); + BT_ASSERT_PRE_MSG_ITER_NON_NULL(iterator); BT_ASSERT_PRE_ITER_HAS_STATE_TO_SEEK(iterator); BT_ASSERT_PRE( bt_component_borrow_graph(iterator->upstream_component)->config_state != @@ -1917,7 +1918,7 @@ bt_bool bt_self_message_iterator_is_interrupted( const struct bt_message_iterator *iterator = (const void *) self_msg_iter; - BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator"); + BT_ASSERT_PRE_MSG_ITER_NON_NULL(iterator); return (bt_bool) bt_graph_is_interrupted(iterator->graph); } diff --git a/src/lib/graph/message-iterator-class.c b/src/lib/graph/message-iterator-class.c index 6ef9e72a..ad4bdb56 100644 --- a/src/lib/graph/message-iterator-class.c +++ b/src/lib/graph/message-iterator-class.c @@ -82,8 +82,8 @@ bt_message_iterator_class_set_initialize_method( bt_message_iterator_class_initialize_method method) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(message_iterator_class, "Message iterator class"); - BT_ASSERT_PRE_NON_NULL(method, "Method"); + BT_ASSERT_PRE_MSG_ITER_CLS_NON_NULL(message_iterator_class); + BT_ASSERT_PRE_METHOD_NON_NULL(method); BT_ASSERT_COND_DEV_MSG_ITER_CLS_HOT(message_iterator_class); message_iterator_class->methods.initialize = method; BT_LIB_LOGD("Set message iterator class's iterator initialization method" @@ -97,8 +97,8 @@ bt_message_iterator_class_set_finalize_method( bt_message_iterator_class_finalize_method method) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(message_iterator_class, "Message iterator class"); - BT_ASSERT_PRE_NON_NULL(method, "Method"); + BT_ASSERT_PRE_MSG_ITER_CLS_NON_NULL(message_iterator_class); + BT_ASSERT_PRE_METHOD_NON_NULL(method); BT_ASSERT_COND_DEV_MSG_ITER_CLS_HOT(message_iterator_class); message_iterator_class->methods.finalize = method; BT_LIB_LOGD("Set message iterator class's finalization method" @@ -113,7 +113,7 @@ bt_message_iterator_class_set_seek_ns_from_origin_methods( bt_message_iterator_class_can_seek_ns_from_origin_method can_seek_method) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(message_iterator_class, "Message iterator class"); + BT_ASSERT_PRE_MSG_ITER_CLS_NON_NULL(message_iterator_class); BT_ASSERT_PRE_NON_NULL(seek_method, "Seek method"); BT_ASSERT_COND_DEV_MSG_ITER_CLS_HOT(message_iterator_class); message_iterator_class->methods.seek_ns_from_origin = seek_method; @@ -130,7 +130,7 @@ bt_message_iterator_class_set_seek_beginning_methods( bt_message_iterator_class_can_seek_beginning_method can_seek_method) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(message_iterator_class, "Message iterator class"); + BT_ASSERT_PRE_MSG_ITER_CLS_NON_NULL(message_iterator_class); BT_ASSERT_PRE_NON_NULL(seek_method, "Seek method"); BT_ASSERT_COND_DEV_MSG_ITER_CLS_HOT(message_iterator_class); message_iterator_class->methods.seek_beginning = seek_method; diff --git a/src/lib/graph/message/discarded-items.c b/src/lib/graph/message/discarded-items.c index e04654f2..975d22d7 100644 --- a/src/lib/graph/message/discarded-items.c +++ b/src/lib/graph/message/discarded-items.c @@ -55,8 +55,8 @@ struct bt_message *create_discarded_items_message( bool has_support; bool need_cs; - BT_ASSERT_PRE_NON_NULL(self_msg_iter, "Message iterator"); - BT_ASSERT_PRE_NON_NULL(stream, "Stream"); + BT_ASSERT_PRE_MSG_ITER_NON_NULL(self_msg_iter); + BT_ASSERT_PRE_STREAM_NON_NULL(stream); stream_class = bt_stream_borrow_class(stream); BT_ASSERT(stream_class); @@ -155,7 +155,7 @@ void set_discarded_items_message_count(struct bt_message *message, struct bt_message_discarded_items *disc_items_msg = (void *) message; BT_ASSERT(message); - BT_ASSERT_PRE_DEV_HOT(message, "Message", ": %!+n", message); + BT_ASSERT_PRE_DEV_MSG_HOT(message); bt_property_uint_set(&disc_items_msg->count, count); } @@ -179,10 +179,8 @@ borrow_discarded_items_message_beginning_default_clock_snapshot_const( struct bt_message_discarded_items *disc_items_msg = (void *) message; BT_ASSERT_DBG(message); - BT_ASSERT_PRE_DEV(disc_items_msg->stream->class->default_clock_class, - "Message's stream's class has no default clock class: " - "%![msg-]+n, %![sc-]+S", - message, disc_items_msg->stream->class); + BT_ASSERT_PRE_DEV_MSG_SC_DEF_CLK_CLS(message, + disc_items_msg->stream->class); return disc_items_msg->default_begin_cs; } @@ -194,10 +192,8 @@ borrow_discarded_items_message_end_default_clock_snapshot_const( struct bt_message_discarded_items *disc_items_msg = (void *) message; BT_ASSERT_DBG(message); - BT_ASSERT_PRE_DEV(disc_items_msg->stream->class->default_clock_class, - "Message's stream's class has no default clock class: " - "%![msg-]+n, %![sc-]+S", - message, disc_items_msg->stream->class); + BT_ASSERT_PRE_DEV_MSG_SC_DEF_CLK_CLS(message, + disc_items_msg->stream->class); return disc_items_msg->default_end_cs; } @@ -218,7 +214,8 @@ struct bt_message *bt_message_discarded_events_create_with_default_clock_snapsho uint64_t end_raw_value) { BT_ASSERT_PRE_DEV_NO_ERROR(); - BT_ASSERT_PRE_BEGIN_LE_END(message_iterator, beginning_raw_value, end_raw_value); + BT_ASSERT_PRE_BEGIN_LE_END(message_iterator, + beginning_raw_value, end_raw_value); return create_discarded_items_message(message_iterator, BT_MESSAGE_TYPE_DISCARDED_EVENTS, (void *) stream, @@ -228,15 +225,16 @@ struct bt_message *bt_message_discarded_events_create_with_default_clock_snapsho struct bt_stream *bt_message_discarded_events_borrow_stream( struct bt_message *message) { - BT_ASSERT_PRE_DEV_NON_NULL(message, "Message"); - BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(message, BT_MESSAGE_TYPE_DISCARDED_EVENTS); + BT_ASSERT_PRE_DEV_MSG_NON_NULL(message); + BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(message, + BT_MESSAGE_TYPE_DISCARDED_EVENTS); return borrow_discarded_items_message_stream(message); } void bt_message_discarded_events_set_count(struct bt_message *message, uint64_t count) { - BT_ASSERT_PRE_NON_NULL(message, "Message"); + BT_ASSERT_PRE_MSG_NON_NULL(message); BT_ASSERT_PRE_MSG_HAS_TYPE(message, BT_MESSAGE_TYPE_DISCARDED_EVENTS); BT_ASSERT_PRE(count > 0, "Discarded event count is 0."); set_discarded_items_message_count(message, count); @@ -246,7 +244,7 @@ const struct bt_clock_snapshot * bt_message_discarded_events_borrow_beginning_default_clock_snapshot_const( const struct bt_message *msg) { - BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message"); + BT_ASSERT_PRE_DEV_MSG_NON_NULL(msg); BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(msg, BT_MESSAGE_TYPE_DISCARDED_EVENTS); return borrow_discarded_items_message_beginning_default_clock_snapshot_const( msg); @@ -256,7 +254,7 @@ const struct bt_clock_snapshot * bt_message_discarded_events_borrow_end_default_clock_snapshot_const( const struct bt_message *msg) { - BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message"); + BT_ASSERT_PRE_DEV_MSG_NON_NULL(msg); BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(msg, BT_MESSAGE_TYPE_DISCARDED_EVENTS); return borrow_discarded_items_message_end_default_clock_snapshot_const( msg); @@ -272,7 +270,7 @@ bt_message_discarded_events_borrow_stream_const(const struct bt_message *message enum bt_property_availability bt_message_discarded_events_get_count( const struct bt_message *message, uint64_t *count) { - BT_ASSERT_PRE_DEV_NON_NULL(message, "Message"); + BT_ASSERT_PRE_DEV_MSG_NON_NULL(message); BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(message, BT_MESSAGE_TYPE_DISCARDED_EVENTS); return get_discarded_items_message_count(message, count); @@ -295,7 +293,8 @@ struct bt_message *bt_message_discarded_packets_create_with_default_clock_snapsh uint64_t end_raw_value) { BT_ASSERT_PRE_DEV_NO_ERROR(); - BT_ASSERT_PRE_BEGIN_LE_END(message_iterator, beginning_raw_value, end_raw_value); + BT_ASSERT_PRE_BEGIN_LE_END(message_iterator, + beginning_raw_value, end_raw_value); return create_discarded_items_message(message_iterator, BT_MESSAGE_TYPE_DISCARDED_PACKETS, (void *) stream, @@ -305,7 +304,7 @@ struct bt_message *bt_message_discarded_packets_create_with_default_clock_snapsh struct bt_stream *bt_message_discarded_packets_borrow_stream( struct bt_message *message) { - BT_ASSERT_PRE_DEV_NON_NULL(message, "Message"); + BT_ASSERT_PRE_DEV_MSG_NON_NULL(message); BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(message, BT_MESSAGE_TYPE_DISCARDED_PACKETS); return borrow_discarded_items_message_stream(message); @@ -314,7 +313,7 @@ struct bt_stream *bt_message_discarded_packets_borrow_stream( void bt_message_discarded_packets_set_count(struct bt_message *message, uint64_t count) { - BT_ASSERT_PRE_NON_NULL(message, "Message"); + BT_ASSERT_PRE_MSG_NON_NULL(message); BT_ASSERT_PRE_MSG_HAS_TYPE(message, BT_MESSAGE_TYPE_DISCARDED_PACKETS); BT_ASSERT_PRE(count > 0, "Discarded packet count is 0."); set_discarded_items_message_count(message, count); @@ -324,7 +323,7 @@ const struct bt_clock_snapshot * bt_message_discarded_packets_borrow_beginning_default_clock_snapshot_const( const struct bt_message *msg) { - BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message"); + BT_ASSERT_PRE_DEV_MSG_NON_NULL(msg); BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(msg, BT_MESSAGE_TYPE_DISCARDED_PACKETS); return borrow_discarded_items_message_beginning_default_clock_snapshot_const( msg); @@ -334,7 +333,7 @@ const struct bt_clock_snapshot * bt_message_discarded_packets_borrow_end_default_clock_snapshot_const( const struct bt_message *msg) { - BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message"); + BT_ASSERT_PRE_DEV_MSG_NON_NULL(msg); BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(msg, BT_MESSAGE_TYPE_DISCARDED_PACKETS); return borrow_discarded_items_message_end_default_clock_snapshot_const( msg); @@ -350,7 +349,7 @@ bt_message_discarded_packets_borrow_stream_const(const struct bt_message *messag enum bt_property_availability bt_message_discarded_packets_get_count( const struct bt_message *message, uint64_t *count) { - BT_ASSERT_PRE_DEV_NON_NULL(message, "Message"); + BT_ASSERT_PRE_DEV_MSG_NON_NULL(message); BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(message, BT_MESSAGE_TYPE_DISCARDED_PACKETS); return get_discarded_items_message_count(message, count); @@ -371,7 +370,7 @@ const struct bt_clock_class * bt_message_discarded_events_borrow_stream_class_default_clock_class_const( const struct bt_message *msg) { - BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message"); + BT_ASSERT_PRE_DEV_MSG_NON_NULL(msg); BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(msg, BT_MESSAGE_TYPE_DISCARDED_EVENTS); return borrow_discarded_items_message_stream_class_default_clock_class( msg); @@ -381,7 +380,7 @@ const struct bt_clock_class * bt_message_discarded_packets_borrow_stream_class_default_clock_class_const( const struct bt_message *msg) { - BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message"); + BT_ASSERT_PRE_DEV_MSG_NON_NULL(msg); BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(msg, BT_MESSAGE_TYPE_DISCARDED_PACKETS); return borrow_discarded_items_message_stream_class_default_clock_class( msg); diff --git a/src/lib/graph/message/event.c b/src/lib/graph/message/event.c index aa0df8b9..ac567bfa 100644 --- a/src/lib/graph/message/event.c +++ b/src/lib/graph/message/event.c @@ -121,8 +121,8 @@ struct bt_message *create_event_message( struct bt_event *event; BT_ASSERT_DBG(stream); - BT_ASSERT_PRE_NON_NULL(msg_iter, "Message iterator"); - BT_ASSERT_PRE_NON_NULL(event_class, "Event class"); + BT_ASSERT_PRE_MSG_ITER_NON_NULL(msg_iter); + BT_ASSERT_PRE_EC_NON_NULL(event_class); BT_ASSERT_PRE(event_class_has_trace(event_class), "Event class is not part of a trace: %!+E", event_class); BT_ASSERT_PRE_DEV(bt_event_class_borrow_stream_class(event_class) == @@ -208,7 +208,7 @@ struct bt_message *bt_message_event_create( const struct bt_stream *stream) { BT_ASSERT_PRE_DEV_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(stream, "Stream"); + BT_ASSERT_PRE_STREAM_NON_NULL(stream); return create_event_message(msg_iter, event_class, NULL, stream, false, 0); } @@ -218,7 +218,7 @@ struct bt_message *bt_message_event_create_with_packet( const struct bt_packet *packet) { BT_ASSERT_PRE_DEV_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(packet, "Packet"); + BT_ASSERT_PRE_PACKET_NON_NULL(packet); return create_event_message(msg_iter, event_class, packet, packet->stream, false, 0); } @@ -230,7 +230,7 @@ struct bt_message *bt_message_event_create_with_default_clock_snapshot( uint64_t raw_value) { BT_ASSERT_PRE_DEV_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(stream, "Stream"); + BT_ASSERT_PRE_STREAM_NON_NULL(stream); return create_event_message(msg_iter, event_class, NULL, stream, true, raw_value); } @@ -243,7 +243,7 @@ bt_message_event_create_with_packet_and_default_clock_snapshot( uint64_t raw_value) { BT_ASSERT_PRE_DEV_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(packet, "Packet"); + BT_ASSERT_PRE_PACKET_NON_NULL(packet); return create_event_message(msg_iter, event_class, packet, packet->stream, true, raw_value); } @@ -304,7 +304,7 @@ struct bt_event *borrow_event(struct bt_message *message) { struct bt_message_event *event_message; - BT_ASSERT_PRE_DEV_NON_NULL(message, "Message"); + BT_ASSERT_PRE_DEV_MSG_NON_NULL(message); BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(message, BT_MESSAGE_TYPE_EVENT); event_message = container_of(message, struct bt_message_event, parent); @@ -330,14 +330,12 @@ bt_message_event_borrow_default_clock_snapshot_const( struct bt_message_event *event_msg = (void *) msg; struct bt_stream_class *stream_class; - BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message"); + BT_ASSERT_PRE_DEV_MSG_NON_NULL(msg); BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(msg, BT_MESSAGE_TYPE_EVENT); stream_class = bt_event_class_borrow_stream_class_inline( event_msg->event->class); BT_ASSERT_DBG(stream_class); - BT_ASSERT_PRE_DEV(stream_class->default_clock_class, - "Message's stream's class has no default clock class: " - "%![msg-]+n, %![sc-]+S", msg, stream_class); + BT_ASSERT_PRE_DEV_MSG_SC_DEF_CLK_CLS(msg, stream_class); return event_msg->default_cs; } @@ -348,7 +346,7 @@ bt_message_event_borrow_stream_class_default_clock_class_const( struct bt_message_event *event_msg = (void *) msg; struct bt_stream_class *stream_class; - BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message"); + BT_ASSERT_PRE_DEV_MSG_NON_NULL(msg); BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(msg, BT_MESSAGE_TYPE_EVENT); stream_class = bt_event_class_borrow_stream_class_inline( event_msg->event->class); diff --git a/src/lib/graph/message/message-iterator-inactivity.c b/src/lib/graph/message/message-iterator-inactivity.c index 4223585d..f6769aff 100644 --- a/src/lib/graph/message/message-iterator-inactivity.c +++ b/src/lib/graph/message/message-iterator-inactivity.c @@ -45,8 +45,8 @@ struct bt_message *bt_message_message_iterator_inactivity_create( struct bt_message *ret_msg = NULL; BT_ASSERT_PRE_DEV_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(msg_iter, "Message iterator"); - BT_ASSERT_PRE_NON_NULL(clock_class, "Default clock class"); + BT_ASSERT_PRE_MSG_ITER_NON_NULL(msg_iter); + BT_ASSERT_PRE_DEF_CLK_CLS_NON_NULL(clock_class); BT_LIB_LOGD("Creating message iterator inactivity message object: " "%![iter-]+i, %![cc-]+K, value=%" PRIu64, msg_iter, clock_class, value_cycles); @@ -85,7 +85,7 @@ bt_message_message_iterator_inactivity_borrow_clock_snapshot_const( { struct bt_message_message_iterator_inactivity *inactivity = (void *) msg; - BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message"); + BT_ASSERT_PRE_DEV_MSG_NON_NULL(msg); BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(msg, BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY); return inactivity->cs; diff --git a/src/lib/graph/message/message.c b/src/lib/graph/message/message.c index 734281bd..f5e21c3e 100644 --- a/src/lib/graph/message/message.c +++ b/src/lib/graph/message/message.c @@ -32,7 +32,7 @@ void bt_message_init(struct bt_message *message, enum bt_message_type bt_message_get_type( const struct bt_message *message) { - BT_ASSERT_PRE_DEV_NON_NULL(message, "Message"); + BT_ASSERT_PRE_DEV_MSG_NON_NULL(message); return message->type; } diff --git a/src/lib/graph/message/packet.c b/src/lib/graph/message/packet.c index 73a3e39d..8baa25fc 100644 --- a/src/lib/graph/message/packet.c +++ b/src/lib/graph/message/packet.c @@ -75,7 +75,7 @@ struct bt_message *create_packet_message( bool need_cs; BT_ASSERT(msg_iter); - BT_ASSERT_PRE_NON_NULL(packet, "Packet"); + BT_ASSERT_PRE_PACKET_NON_NULL(packet); stream = bt_packet_borrow_stream(packet); BT_ASSERT(stream); stream_class = bt_stream_borrow_class(stream); @@ -155,7 +155,7 @@ struct bt_message *bt_message_packet_beginning_create( (void *) self_msg_iter; BT_ASSERT_PRE_DEV_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(msg_iter, "Message iterator"); + BT_ASSERT_PRE_MSG_ITER_NON_NULL(msg_iter); return create_packet_message(msg_iter, (void *) packet, &msg_iter->graph->packet_begin_msg_pool, false, 0); } @@ -168,7 +168,7 @@ struct bt_message *bt_message_packet_beginning_create_with_default_clock_snapsho (void *) self_msg_iter; BT_ASSERT_PRE_DEV_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(msg_iter, "Message iterator"); + BT_ASSERT_PRE_MSG_ITER_NON_NULL(msg_iter); return create_packet_message(msg_iter, (void *) packet, &msg_iter->graph->packet_begin_msg_pool, true, raw_value); } @@ -181,7 +181,7 @@ struct bt_message *bt_message_packet_end_create( (void *) self_msg_iter; BT_ASSERT_PRE_DEV_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(msg_iter, "Message iterator"); + BT_ASSERT_PRE_MSG_ITER_NON_NULL(msg_iter); return create_packet_message(msg_iter, (void *) packet, &msg_iter->graph->packet_end_msg_pool, false, 0); } @@ -194,7 +194,7 @@ struct bt_message *bt_message_packet_end_create_with_default_clock_snapshot( (void *) self_msg_iter; BT_ASSERT_PRE_DEV_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(msg_iter, "Message iterator"); + BT_ASSERT_PRE_MSG_ITER_NON_NULL(msg_iter); return create_packet_message(msg_iter, (void *) packet, &msg_iter->graph->packet_end_msg_pool, true, raw_value); } @@ -266,7 +266,7 @@ struct bt_packet *bt_message_packet_beginning_borrow_packet( { struct bt_message_packet *packet_msg = (void *) message; - BT_ASSERT_PRE_DEV_NON_NULL(message, "Message"); + BT_ASSERT_PRE_DEV_MSG_NON_NULL(message); BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(message, BT_MESSAGE_TYPE_PACKET_BEGINNING); return packet_msg->packet; @@ -284,7 +284,7 @@ struct bt_packet *bt_message_packet_end_borrow_packet( { struct bt_message_packet *packet_msg = (void *) message; - BT_ASSERT_PRE_DEV_NON_NULL(message, "Message"); + BT_ASSERT_PRE_DEV_MSG_NON_NULL(message); BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(message, BT_MESSAGE_TYPE_PACKET_END); return packet_msg->packet; @@ -305,11 +305,8 @@ borrow_packet_message_default_clock_snapshot_const( struct bt_message_packet *packet_msg = (void *) message; BT_ASSERT_DBG(message); - BT_ASSERT_PRE_DEV( - packet_msg->packet->stream->class->default_clock_class, - "Message's stream's class has no default clock class: " - "%![msg-]+n, %![sc-]+S", - message, packet_msg->packet->stream->class); + BT_ASSERT_PRE_DEV_MSG_SC_DEF_CLK_CLS(message, + packet_msg->packet->stream->class); return packet_msg->default_cs; } @@ -317,7 +314,7 @@ const struct bt_clock_snapshot * bt_message_packet_beginning_borrow_default_clock_snapshot_const( const struct bt_message *msg) { - BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message"); + BT_ASSERT_PRE_DEV_MSG_NON_NULL(msg); BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(msg, BT_MESSAGE_TYPE_PACKET_BEGINNING); return borrow_packet_message_default_clock_snapshot_const(msg); } @@ -326,7 +323,7 @@ const struct bt_clock_snapshot * bt_message_packet_end_borrow_default_clock_snapshot_const( const struct bt_message *msg) { - BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message"); + BT_ASSERT_PRE_DEV_MSG_NON_NULL(msg); BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(msg, BT_MESSAGE_TYPE_PACKET_END); return borrow_packet_message_default_clock_snapshot_const(msg); } @@ -346,7 +343,7 @@ const struct bt_clock_class * bt_message_packet_beginning_borrow_stream_class_default_clock_class_const( const struct bt_message *msg) { - BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message"); + BT_ASSERT_PRE_DEV_MSG_NON_NULL(msg); BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(msg, BT_MESSAGE_TYPE_PACKET_BEGINNING); return borrow_packet_message_stream_class_default_clock_class(msg); } @@ -355,7 +352,7 @@ const struct bt_clock_class * bt_message_packet_end_borrow_stream_class_default_clock_class_const( const struct bt_message *msg) { - BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message"); + BT_ASSERT_PRE_DEV_MSG_NON_NULL(msg); BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(msg, BT_MESSAGE_TYPE_PACKET_END); return borrow_packet_message_stream_class_default_clock_class(msg); } diff --git a/src/lib/graph/message/stream.c b/src/lib/graph/message/stream.c index ad93031f..f92fc3d0 100644 --- a/src/lib/graph/message/stream.c +++ b/src/lib/graph/message/stream.c @@ -47,8 +47,8 @@ struct bt_message *create_stream_message( struct bt_message_stream *message; struct bt_stream_class *stream_class; - BT_ASSERT_PRE_NON_NULL(self_msg_iter, "Message iterator"); - BT_ASSERT_PRE_NON_NULL(stream, "Stream"); + BT_ASSERT_PRE_MSG_ITER_NON_NULL(self_msg_iter); + BT_ASSERT_PRE_STREAM_NON_NULL(stream); stream_class = bt_stream_borrow_class(stream); BT_ASSERT(stream_class); BT_LIB_LOGD("Creating stream message object: " @@ -123,7 +123,7 @@ struct bt_stream *borrow_stream_message_stream(struct bt_message *message) struct bt_stream *bt_message_stream_beginning_borrow_stream( struct bt_message *message) { - BT_ASSERT_PRE_DEV_NON_NULL(message, "Message"); + BT_ASSERT_PRE_DEV_MSG_NON_NULL(message); BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(message, BT_MESSAGE_TYPE_STREAM_BEGINNING); return borrow_stream_message_stream(message); @@ -132,7 +132,7 @@ struct bt_stream *bt_message_stream_beginning_borrow_stream( struct bt_stream *bt_message_stream_end_borrow_stream( struct bt_message *message) { - BT_ASSERT_PRE_DEV_NON_NULL(message, "Message"); + BT_ASSERT_PRE_DEV_MSG_NON_NULL(message); BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(message, BT_MESSAGE_TYPE_STREAM_END); return borrow_stream_message_stream(message); @@ -163,9 +163,7 @@ void bt_message_stream_set_default_clock_snapshot( BT_ASSERT_PRE_DEV_HOT(msg, "Message", ": %!+n", msg); sc = stream_msg->stream->class; BT_ASSERT(sc); - BT_ASSERT_PRE(sc->default_clock_class, - "Message's stream's class has no default clock class: " - "%![msg-]+n, %![sc-]+S", msg, sc); + BT_ASSERT_PRE_DEV_MSG_SC_DEF_CLK_CLS(msg, sc); BT_ASSERT(stream_msg->default_cs); bt_clock_snapshot_set_raw_value(stream_msg->default_cs, raw_value); stream_msg->default_cs_state = BT_MESSAGE_STREAM_CLOCK_SNAPSHOT_STATE_KNOWN; @@ -176,7 +174,7 @@ void bt_message_stream_set_default_clock_snapshot( void bt_message_stream_beginning_set_default_clock_snapshot( struct bt_message *message, uint64_t raw_value) { - BT_ASSERT_PRE_NON_NULL(message, "Message"); + BT_ASSERT_PRE_MSG_NON_NULL(message); BT_ASSERT_PRE_MSG_HAS_TYPE(message, BT_MESSAGE_TYPE_STREAM_BEGINNING); bt_message_stream_set_default_clock_snapshot(message, raw_value); @@ -185,7 +183,7 @@ void bt_message_stream_beginning_set_default_clock_snapshot( void bt_message_stream_end_set_default_clock_snapshot( struct bt_message *message, uint64_t raw_value) { - BT_ASSERT_PRE_NON_NULL(message, "Message"); + BT_ASSERT_PRE_MSG_NON_NULL(message); BT_ASSERT_PRE_MSG_HAS_TYPE(message, BT_MESSAGE_TYPE_STREAM_END); return bt_message_stream_set_default_clock_snapshot(message, raw_value); @@ -201,9 +199,7 @@ bt_message_stream_borrow_default_clock_snapshot_const( BT_ASSERT_DBG(msg); sc = stream_msg->stream->class; BT_ASSERT_DBG(sc); - BT_ASSERT_PRE_DEV(sc->default_clock_class, - "Message's stream's class has no default clock class: " - "%![msg-]+n, %![sc-]+S", msg, sc); + BT_ASSERT_PRE_DEV_MSG_SC_DEF_CLK_CLS(msg, sc); BT_ASSERT_DBG(stream_msg->default_cs); *snapshot = stream_msg->default_cs; @@ -215,7 +211,7 @@ enum bt_message_stream_clock_snapshot_state bt_message_stream_beginning_borrow_default_clock_snapshot_const( const bt_message *message, const bt_clock_snapshot **snapshot) { - BT_ASSERT_PRE_DEV_NON_NULL(message, "Message"); + BT_ASSERT_PRE_DEV_MSG_NON_NULL(message); BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(message, BT_MESSAGE_TYPE_STREAM_BEGINNING); return bt_message_stream_borrow_default_clock_snapshot_const( @@ -226,7 +222,7 @@ enum bt_message_stream_clock_snapshot_state bt_message_stream_end_borrow_default_clock_snapshot_const( const bt_message *message, const bt_clock_snapshot **snapshot) { - BT_ASSERT_PRE_DEV_NON_NULL(message, "Message"); + BT_ASSERT_PRE_DEV_MSG_NON_NULL(message); BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(message, BT_MESSAGE_TYPE_STREAM_END); return bt_message_stream_borrow_default_clock_snapshot_const( message, snapshot); @@ -247,7 +243,7 @@ const struct bt_clock_class * bt_message_stream_beginning_borrow_stream_class_default_clock_class_const( const struct bt_message *msg) { - BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message"); + BT_ASSERT_PRE_DEV_MSG_NON_NULL(msg); BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(msg, BT_MESSAGE_TYPE_STREAM_BEGINNING); return borrow_stream_message_stream_class_default_clock_class(msg); @@ -257,7 +253,7 @@ const struct bt_clock_class * bt_message_stream_end_borrow_stream_class_default_clock_class_const( const struct bt_message *msg) { - BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message"); + BT_ASSERT_PRE_DEV_MSG_NON_NULL(msg); BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(msg, BT_MESSAGE_TYPE_STREAM_END); return borrow_stream_message_stream_class_default_clock_class(msg); } diff --git a/src/lib/graph/mip.c b/src/lib/graph/mip.c index d32e8054..0252e5ea 100644 --- a/src/lib/graph/mip.c +++ b/src/lib/graph/mip.c @@ -179,7 +179,7 @@ bt_get_greatest_operative_mip_version( int status = BT_FUNC_STATUS_OK; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(comp_descr_set, "Component descriptor set"); + BT_ASSERT_PRE_COMP_DESCR_SET_NON_NULL(comp_descr_set); BT_ASSERT_PRE_NON_NULL(operative_mip_version, "Operative MIP version (output)"); BT_ASSERT_PRE(comp_descr_set->sources->len + diff --git a/src/lib/graph/port.c b/src/lib/graph/port.c index 52ebc7f8..291615a8 100644 --- a/src/lib/graph/port.c +++ b/src/lib/graph/port.c @@ -73,34 +73,34 @@ end: const char *bt_port_get_name(const struct bt_port *port) { - BT_ASSERT_PRE_DEV_NON_NULL(port, "Port"); + BT_ASSERT_PRE_DEV_PORT_NON_NULL(port); return port->name->str; } enum bt_port_type bt_port_get_type(const struct bt_port *port) { - BT_ASSERT_PRE_DEV_NON_NULL(port, "Port"); + BT_ASSERT_PRE_DEV_PORT_NON_NULL(port); return port->type; } const struct bt_connection *bt_port_borrow_connection_const( const struct bt_port *port) { - BT_ASSERT_PRE_DEV_NON_NULL(port, "Port"); + BT_ASSERT_PRE_DEV_PORT_NON_NULL(port); return port->connection; } const struct bt_component *bt_port_borrow_component_const( const struct bt_port *port) { - BT_ASSERT_PRE_DEV_NON_NULL(port, "Port"); + BT_ASSERT_PRE_DEV_PORT_NON_NULL(port); return bt_port_borrow_component_inline(port); } struct bt_self_component *bt_self_component_port_borrow_component( struct bt_self_component_port *port) { - BT_ASSERT_PRE_DEV_NON_NULL(port, "Port"); + BT_ASSERT_PRE_DEV_PORT_NON_NULL(port); return (void *) bt_object_borrow_parent((void *) port); } @@ -120,13 +120,13 @@ void bt_port_set_connection(struct bt_port *port, bt_bool bt_port_is_connected(const struct bt_port *port) { - BT_ASSERT_PRE_DEV_NON_NULL(port, "Port"); + BT_ASSERT_PRE_DEV_PORT_NON_NULL(port); return port->connection ? BT_TRUE : BT_FALSE; } void *bt_self_component_port_get_data(const struct bt_self_component_port *port) { - BT_ASSERT_PRE_DEV_NON_NULL(port, "Port"); + BT_ASSERT_PRE_DEV_PORT_NON_NULL(port); return ((struct bt_port *) port)->user_data; } diff --git a/src/lib/graph/query-executor.c b/src/lib/graph/query-executor.c index e375979b..be5bbba1 100644 --- a/src/lib/graph/query-executor.c +++ b/src/lib/graph/query-executor.c @@ -57,7 +57,7 @@ struct bt_query_executor *bt_query_executor_create_with_method_data( struct bt_query_executor *query_exec; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class"); + BT_ASSERT_PRE_COMP_CLS_NON_NULL(comp_cls); BT_ASSERT_PRE_NON_NULL(object, "Object"); BT_LIB_LOGD("Creating query executor: " "%![comp-cls-]+C, object=\"%s\", %![params-]+v", @@ -142,8 +142,8 @@ enum bt_query_executor_query_status bt_query_executor_query( method_t method = NULL; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(query_exec, "Query executor"); - BT_ASSERT_PRE_NON_NULL(user_result, "Result (output)"); + BT_ASSERT_PRE_QUERY_EXEC_NON_NULL(query_exec); + BT_ASSERT_PRE_RES_OUT_NON_NULL(user_result); /* * Initial check: is the query executor already interrupted? If @@ -242,8 +242,8 @@ enum bt_query_executor_add_interrupter_status bt_query_executor_add_interrupter( const struct bt_interrupter *intr) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(query_exec, "Query executor"); - BT_ASSERT_PRE_NON_NULL(intr, "Interrupter"); + BT_ASSERT_PRE_QUERY_EXEC_NON_NULL(query_exec); + BT_ASSERT_PRE_INTR_NON_NULL(intr); g_ptr_array_add(query_exec->interrupters, (void *) intr); bt_object_get_ref_no_null_check(intr); BT_LIB_LOGD("Added interrupter to query executor: " @@ -254,7 +254,7 @@ enum bt_query_executor_add_interrupter_status bt_query_executor_add_interrupter( bt_bool bt_query_executor_is_interrupted(const struct bt_query_executor *query_exec) { - BT_ASSERT_PRE_NON_NULL(query_exec, "Query executor"); + BT_ASSERT_PRE_QUERY_EXEC_NON_NULL(query_exec); return (bt_bool) bt_interrupter_array_any_is_set( query_exec->interrupters); } @@ -262,7 +262,7 @@ bt_bool bt_query_executor_is_interrupted(const struct bt_query_executor *query_e struct bt_interrupter *bt_query_executor_borrow_default_interrupter( struct bt_query_executor *query_exec) { - BT_ASSERT_PRE_NON_NULL(query_exec, "Query executor"); + BT_ASSERT_PRE_QUERY_EXEC_NON_NULL(query_exec); return query_exec->default_interrupter; } @@ -270,7 +270,7 @@ enum bt_query_executor_set_logging_level_status bt_query_executor_set_logging_level(struct bt_query_executor *query_exec, enum bt_logging_level log_level) { - BT_ASSERT_PRE_NON_NULL(query_exec, "Query executor"); + BT_ASSERT_PRE_QUERY_EXEC_NON_NULL(query_exec); query_exec->log_level = log_level; return BT_FUNC_STATUS_OK; } @@ -278,7 +278,7 @@ bt_query_executor_set_logging_level(struct bt_query_executor *query_exec, enum bt_logging_level bt_query_executor_get_logging_level( const struct bt_query_executor *query_exec) { - BT_ASSERT_PRE_NON_NULL(query_exec, "Query executor"); + BT_ASSERT_PRE_QUERY_EXEC_NON_NULL(query_exec); return query_exec->log_level; } diff --git a/src/lib/integer-range-set.c b/src/lib/integer-range-set.c index 8853d702..2fe13ec5 100644 --- a/src/lib/integer-range-set.c +++ b/src/lib/integer-range-set.c @@ -21,7 +21,7 @@ uint64_t bt_integer_range_unsigned_get_lower( { const struct bt_integer_range *range = (const void *) u_range; - BT_ASSERT_PRE_DEV_NON_NULL(range, "Integer range"); + BT_ASSERT_PRE_DEV_INT_RANGE_NON_NULL(range); return range->lower.u; } @@ -30,7 +30,7 @@ uint64_t bt_integer_range_unsigned_get_upper( { const struct bt_integer_range *range = (const void *) u_range; - BT_ASSERT_PRE_DEV_NON_NULL(range, "Integer range"); + BT_ASSERT_PRE_DEV_INT_RANGE_NON_NULL(range); return range->upper.u; } @@ -39,7 +39,7 @@ int64_t bt_integer_range_signed_get_lower( { const struct bt_integer_range *range = (const void *) i_range; - BT_ASSERT_PRE_DEV_NON_NULL(range, "Integer range"); + BT_ASSERT_PRE_DEV_INT_RANGE_NON_NULL(range); return range->lower.i; } @@ -48,7 +48,7 @@ int64_t bt_integer_range_signed_get_upper( { const struct bt_integer_range *range = (const void *) i_range; - BT_ASSERT_PRE_DEV_NON_NULL(range, "Integer range"); + BT_ASSERT_PRE_DEV_INT_RANGE_NON_NULL(range); return range->upper.i; } @@ -83,7 +83,7 @@ bt_bool bt_integer_range_signed_is_equal( uint64_t bt_integer_range_set_get_range_count( const bt_integer_range_set *range_set) { - BT_ASSERT_PRE_DEV_NON_NULL(range_set, "Integer range set"); + BT_ASSERT_PRE_DEV_INT_RANGE_SET_NON_NULL(range_set); return (uint64_t) range_set->ranges->len; } @@ -95,7 +95,7 @@ bt_integer_range_set_unsigned_borrow_range_by_index_const( const struct bt_integer_range_set *range_set = (const void *) u_range_set; - BT_ASSERT_PRE_DEV_NON_NULL(range_set, "Integer range set"); + BT_ASSERT_PRE_DEV_INT_RANGE_SET_NON_NULL(range_set); BT_ASSERT_PRE_DEV_VALID_INDEX(index, range_set->ranges->len); return (const void *) BT_INTEGER_RANGE_SET_RANGE_AT_INDEX(range_set, index); @@ -108,7 +108,7 @@ bt_integer_range_set_signed_borrow_range_by_index_const( const struct bt_integer_range_set *range_set = (const void *) i_range_set; - BT_ASSERT_PRE_DEV_NON_NULL(range_set, "Integer range set"); + BT_ASSERT_PRE_DEV_INT_RANGE_SET_NON_NULL(range_set); BT_ASSERT_PRE_DEV_VALID_INDEX(index, range_set->ranges->len); return (const void *) BT_INTEGER_RANGE_SET_RANGE_AT_INDEX(range_set, index); @@ -185,7 +185,7 @@ void add_range_to_range_set(struct bt_integer_range_set *range_set, .upper.u = u_upper, }; - BT_ASSERT_PRE_NON_NULL(range_set, "Integer range set"); + BT_ASSERT_PRE_INT_RANGE_SET_NON_NULL(range_set); BT_ASSERT_PRE_DEV_HOT(range_set, "Integer range set", ": %!+R", range_set); g_array_append_val(range_set->ranges, range); diff --git a/src/lib/plugin/plugin.c b/src/lib/plugin/plugin.c index af8dc092..c95fe830 100644 --- a/src/lib/plugin/plugin.c +++ b/src/lib/plugin/plugin.c @@ -154,14 +154,14 @@ void fini_python_plugin_provider(void) { uint64_t bt_plugin_set_get_plugin_count(const struct bt_plugin_set *plugin_set) { - BT_ASSERT_PRE_DEV_NON_NULL(plugin_set, "Plugin set"); + BT_ASSERT_PRE_DEV_PLUGIN_SET_NON_NULL(plugin_set); return (uint64_t) plugin_set->plugins->len; } const struct bt_plugin *bt_plugin_set_borrow_plugin_by_index_const( const struct bt_plugin_set *plugin_set, uint64_t index) { - BT_ASSERT_PRE_DEV_NON_NULL(plugin_set, "Plugin set"); + BT_ASSERT_PRE_DEV_PLUGIN_SET_NON_NULL(plugin_set); BT_ASSERT_PRE_DEV_VALID_INDEX(index, plugin_set->plugins->len); return g_ptr_array_index(plugin_set->plugins, index); } @@ -185,7 +185,7 @@ enum bt_plugin_find_all_from_file_status bt_plugin_find_all_from_file( BT_ASSERT_PRE_NO_ERROR(); BT_ASSERT_PRE_NON_NULL(path, "Path"); - BT_ASSERT_PRE_NON_NULL(path, "Plugin set (output)"); + BT_ASSERT_PRE_PLUGIN_SET_OUT_NON_NULL(path); BT_LOGI("Creating plugins from file: path=\"%s\"", path); /* Try shared object plugins */ @@ -268,7 +268,7 @@ enum bt_plugin_find_all_status bt_plugin_find_all(bt_bool find_in_std_env_var, uint64_t dir_i, plugin_i; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(plugin_set_out, "Plugin set (output)"); + BT_ASSERT_PRE_PLUGIN_SET_OUT_NON_NULL(plugin_set_out); BT_LOGI("Finding all plugins in standard directories and built-in plugins: " "find-in-std-env-var=%d, find-in-user-dir=%d, " "find-in-sys-dir=%d, find-in-static=%d", @@ -452,8 +452,8 @@ enum bt_plugin_find_status bt_plugin_find(const char *plugin_name, uint64_t i; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(plugin_name, "Name"); - BT_ASSERT_PRE_NON_NULL(plugin_out, "Plugin (output)"); + BT_ASSERT_PRE_NAME_NON_NULL(plugin_name); + BT_ASSERT_PRE_PLUGIN_OUT_NON_NULL(plugin_out); BT_LOGI("Finding named plugin in standard directories and built-in plugins: " "name=\"%s\", find-in-std-env-var=%d, find-in-user-dir=%d, " "find-in-sys-dir=%d, find-in-static=%d", @@ -654,7 +654,7 @@ enum bt_plugin_find_all_from_dir_status bt_plugin_find_all_from_dir( BT_FUNC_STATUS_OK; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(plugin_set_out, "Plugin set (output)"); + BT_ASSERT_PRE_PLUGIN_SET_OUT_NON_NULL(plugin_set_out); BT_LOGI("Creating all plugins in directory: path=\"%s\", recurse=%d", path, recurse); *plugin_set_out = bt_plugin_set_create(); @@ -706,31 +706,31 @@ end: const char *bt_plugin_get_name(const struct bt_plugin *plugin) { - BT_ASSERT_PRE_DEV_NON_NULL(plugin, "Plugin"); + BT_ASSERT_PRE_DEV_PLUGIN_NON_NULL(plugin); return plugin->info.name_set ? plugin->info.name->str : NULL; } const char *bt_plugin_get_author(const struct bt_plugin *plugin) { - BT_ASSERT_PRE_DEV_NON_NULL(plugin, "Plugin"); + BT_ASSERT_PRE_DEV_PLUGIN_NON_NULL(plugin); return plugin->info.author_set ? plugin->info.author->str : NULL; } const char *bt_plugin_get_license(const struct bt_plugin *plugin) { - BT_ASSERT_PRE_DEV_NON_NULL(plugin, "Plugin"); + BT_ASSERT_PRE_DEV_PLUGIN_NON_NULL(plugin); return plugin->info.license_set ? plugin->info.license->str : NULL; } const char *bt_plugin_get_path(const struct bt_plugin *plugin) { - BT_ASSERT_PRE_DEV_NON_NULL(plugin, "Plugin"); + BT_ASSERT_PRE_DEV_PLUGIN_NON_NULL(plugin); return plugin->info.path_set ? plugin->info.path->str : NULL; } const char *bt_plugin_get_description(const struct bt_plugin *plugin) { - BT_ASSERT_PRE_DEV_NON_NULL(plugin, "Plugin"); + BT_ASSERT_PRE_DEV_PLUGIN_NON_NULL(plugin); return plugin->info.description_set ? plugin->info.description->str : NULL; } @@ -742,7 +742,7 @@ enum bt_property_availability bt_plugin_get_version(const struct bt_plugin *plug enum bt_property_availability avail = BT_PROPERTY_AVAILABILITY_AVAILABLE; - BT_ASSERT_PRE_DEV_NON_NULL(plugin, "Plugin"); + BT_ASSERT_PRE_DEV_PLUGIN_NON_NULL(plugin); if (!plugin->info.version_set) { BT_LIB_LOGD("Plugin's version is not set: %!+l", plugin); @@ -772,19 +772,19 @@ end: uint64_t bt_plugin_get_source_component_class_count(const struct bt_plugin *plugin) { - BT_ASSERT_PRE_DEV_NON_NULL(plugin, "Plugin"); + BT_ASSERT_PRE_DEV_PLUGIN_NON_NULL(plugin); return (uint64_t) plugin->src_comp_classes->len; } uint64_t bt_plugin_get_filter_component_class_count(const struct bt_plugin *plugin) { - BT_ASSERT_PRE_DEV_NON_NULL(plugin, "Plugin"); + BT_ASSERT_PRE_DEV_PLUGIN_NON_NULL(plugin); return (uint64_t) plugin->flt_comp_classes->len; } uint64_t bt_plugin_get_sink_component_class_count(const struct bt_plugin *plugin) { - BT_ASSERT_PRE_DEV_NON_NULL(plugin, "Plugin"); + BT_ASSERT_PRE_DEV_PLUGIN_NON_NULL(plugin); return (uint64_t) plugin->sink_comp_classes->len; } @@ -793,7 +793,7 @@ struct bt_component_class *borrow_component_class_by_index( const struct bt_plugin *plugin, GPtrArray *comp_classes, uint64_t index) { - BT_ASSERT_PRE_DEV_NON_NULL(plugin, "Plugin"); + BT_ASSERT_PRE_DEV_PLUGIN_NON_NULL(plugin); BT_ASSERT_PRE_DEV_VALID_INDEX(index, comp_classes->len); return g_ptr_array_index(comp_classes, index); } @@ -830,8 +830,8 @@ struct bt_component_class *borrow_component_class_by_name( struct bt_component_class *comp_class = NULL; size_t i; - BT_ASSERT_PRE_DEV_NON_NULL(plugin, "Plugin"); - BT_ASSERT_PRE_DEV_NON_NULL(name, "Name"); + BT_ASSERT_PRE_DEV_PLUGIN_NON_NULL(plugin); + BT_ASSERT_PRE_DEV_NAME_NON_NULL(name); for (i = 0; i < comp_classes->len; i++) { struct bt_component_class *comp_class_candidate = diff --git a/src/lib/trace-ir/clock-class.c b/src/lib/trace-ir/clock-class.c index 8d100247..d2c7ab54 100644 --- a/src/lib/trace-ir/clock-class.c +++ b/src/lib/trace-ir/clock-class.c @@ -24,7 +24,7 @@ #include "lib/func-status.h" #include "lib/value.h" -#define BT_ASSERT_PRE_DEV_CLOCK_CLASS_HOT(_cc) \ +#define BT_ASSERT_PRE_DEV_CLOCK_CLASS_HOT(_cc) \ BT_ASSERT_PRE_DEV_HOT((_cc), "Clock class", ": %!+K", (_cc)) static @@ -72,7 +72,7 @@ struct bt_clock_class *bt_clock_class_create(bt_self_component *self_comp) struct bt_clock_class *clock_class = NULL; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(self_comp, "Self component"); + BT_ASSERT_PRE_COMP_NON_NULL(self_comp); BT_LOGD_STR("Creating default clock class object"); clock_class = g_new0(struct bt_clock_class, 1); @@ -129,7 +129,7 @@ end: const char *bt_clock_class_get_name(const struct bt_clock_class *clock_class) { - BT_ASSERT_PRE_DEV_NON_NULL(clock_class, "Clock class"); + BT_ASSERT_PRE_DEV_CLK_CLS_NON_NULL(clock_class); return clock_class->name.value; } @@ -137,8 +137,8 @@ enum bt_clock_class_set_name_status bt_clock_class_set_name( struct bt_clock_class *clock_class, const char *name) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class"); - BT_ASSERT_PRE_NON_NULL(name, "Name"); + BT_ASSERT_PRE_CLK_CLS_NON_NULL(clock_class); + BT_ASSERT_PRE_NAME_NON_NULL(name); BT_ASSERT_PRE_DEV_CLOCK_CLASS_HOT(clock_class); g_string_assign(clock_class->name.str, name); clock_class->name.value = clock_class->name.str->str; @@ -149,7 +149,7 @@ enum bt_clock_class_set_name_status bt_clock_class_set_name( const char *bt_clock_class_get_description( const struct bt_clock_class *clock_class) { - BT_ASSERT_PRE_DEV_NON_NULL(clock_class, "Clock class"); + BT_ASSERT_PRE_DEV_CLK_CLS_NON_NULL(clock_class); return clock_class->description.value; } @@ -157,8 +157,8 @@ enum bt_clock_class_set_description_status bt_clock_class_set_description( struct bt_clock_class *clock_class, const char *descr) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class"); - BT_ASSERT_PRE_NON_NULL(descr, "Description"); + BT_ASSERT_PRE_CLK_CLS_NON_NULL(clock_class); + BT_ASSERT_PRE_DESCR_NON_NULL(descr); BT_ASSERT_PRE_DEV_CLOCK_CLASS_HOT(clock_class); g_string_assign(clock_class->description.str, descr); clock_class->description.value = clock_class->description.str->str; @@ -169,14 +169,14 @@ enum bt_clock_class_set_description_status bt_clock_class_set_description( uint64_t bt_clock_class_get_frequency(const struct bt_clock_class *clock_class) { - BT_ASSERT_PRE_DEV_NON_NULL(clock_class, "Clock class"); + BT_ASSERT_PRE_DEV_CLK_CLS_NON_NULL(clock_class); return clock_class->frequency; } void bt_clock_class_set_frequency(struct bt_clock_class *clock_class, uint64_t frequency) { - BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class"); + BT_ASSERT_PRE_CLK_CLS_NON_NULL(clock_class); BT_ASSERT_PRE_DEV_CLOCK_CLASS_HOT(clock_class); BT_ASSERT_PRE(frequency != UINT64_C(-1) && frequency != 0, "Invalid frequency: %![cc-]+K, new-freq=%" PRIu64, @@ -191,14 +191,14 @@ void bt_clock_class_set_frequency(struct bt_clock_class *clock_class, uint64_t bt_clock_class_get_precision(const struct bt_clock_class *clock_class) { - BT_ASSERT_PRE_DEV_NON_NULL(clock_class, "Clock class"); + BT_ASSERT_PRE_DEV_CLK_CLS_NON_NULL(clock_class); return clock_class->precision; } void bt_clock_class_set_precision(struct bt_clock_class *clock_class, uint64_t precision) { - BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class"); + BT_ASSERT_PRE_CLK_CLS_NON_NULL(clock_class); BT_ASSERT_PRE_DEV_CLOCK_CLASS_HOT(clock_class); BT_ASSERT_PRE(precision != UINT64_C(-1), "Invalid precision: %![cc-]+K, new-precision=%" PRIu64, @@ -210,7 +210,7 @@ void bt_clock_class_set_precision(struct bt_clock_class *clock_class, void bt_clock_class_get_offset(const struct bt_clock_class *clock_class, int64_t *seconds, uint64_t *cycles) { - BT_ASSERT_PRE_DEV_NON_NULL(clock_class, "Clock class"); + BT_ASSERT_PRE_DEV_CLK_CLS_NON_NULL(clock_class); BT_ASSERT_PRE_DEV_NON_NULL(seconds, "Seconds (output)"); BT_ASSERT_PRE_DEV_NON_NULL(cycles, "Cycles (output)"); *seconds = clock_class->offset_seconds; @@ -220,7 +220,7 @@ void bt_clock_class_get_offset(const struct bt_clock_class *clock_class, void bt_clock_class_set_offset(struct bt_clock_class *clock_class, int64_t seconds, uint64_t cycles) { - BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class"); + BT_ASSERT_PRE_CLK_CLS_NON_NULL(clock_class); BT_ASSERT_PRE_DEV_CLOCK_CLASS_HOT(clock_class); BT_ASSERT_PRE(cycles < clock_class->frequency, "Offset (cycles) is greater than clock class's frequency: " @@ -233,14 +233,14 @@ void bt_clock_class_set_offset(struct bt_clock_class *clock_class, bt_bool bt_clock_class_origin_is_unix_epoch(const struct bt_clock_class *clock_class) { - BT_ASSERT_PRE_DEV_NON_NULL(clock_class, "Clock class"); + BT_ASSERT_PRE_DEV_CLK_CLS_NON_NULL(clock_class); return (bool) clock_class->origin_is_unix_epoch; } void bt_clock_class_set_origin_is_unix_epoch(struct bt_clock_class *clock_class, bt_bool origin_is_unix_epoch) { - BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class"); + BT_ASSERT_PRE_CLK_CLS_NON_NULL(clock_class); BT_ASSERT_PRE_DEV_CLOCK_CLASS_HOT(clock_class); clock_class->origin_is_unix_epoch = (bool) origin_is_unix_epoch; BT_LIB_LOGD("Set clock class's origin is Unix epoch property: %!+K", @@ -249,15 +249,15 @@ void bt_clock_class_set_origin_is_unix_epoch(struct bt_clock_class *clock_class, bt_uuid bt_clock_class_get_uuid(const struct bt_clock_class *clock_class) { - BT_ASSERT_PRE_DEV_NON_NULL(clock_class, "Clock class"); + BT_ASSERT_PRE_DEV_CLK_CLS_NON_NULL(clock_class); return clock_class->uuid.value; } void bt_clock_class_set_uuid(struct bt_clock_class *clock_class, bt_uuid uuid) { - BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class"); - BT_ASSERT_PRE_NON_NULL(uuid, "UUID"); + BT_ASSERT_PRE_CLK_CLS_NON_NULL(clock_class); + BT_ASSERT_PRE_UUID_NON_NULL(uuid); BT_ASSERT_PRE_DEV_CLOCK_CLASS_HOT(clock_class); bt_uuid_copy(clock_class->uuid.uuid, uuid); clock_class->uuid.value = clock_class->uuid.uuid; @@ -288,7 +288,7 @@ bt_clock_class_cycles_to_ns_from_origin( int ret; BT_ASSERT_PRE_DEV_NO_ERROR(); - BT_ASSERT_PRE_DEV_NON_NULL(clock_class, "Clock class"); + BT_ASSERT_PRE_DEV_CLK_CLS_NON_NULL(clock_class); BT_ASSERT_PRE_DEV_NON_NULL(ns, "Nanoseconds (output)"); ret = bt_util_ns_from_origin_clock_class(clock_class, cycles, ns); if (ret) { @@ -306,7 +306,7 @@ bt_clock_class_cycles_to_ns_from_origin( const struct bt_value *bt_clock_class_borrow_user_attributes_const( const struct bt_clock_class *clock_class) { - BT_ASSERT_PRE_DEV_NON_NULL(clock_class, "Clock class"); + BT_ASSERT_PRE_DEV_CLK_CLS_NON_NULL(clock_class); return clock_class->user_attributes; } @@ -321,10 +321,9 @@ void bt_clock_class_set_user_attributes( struct bt_clock_class *clock_class, const struct bt_value *user_attributes) { - BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class"); - BT_ASSERT_PRE_NON_NULL(user_attributes, "User attributes"); - BT_ASSERT_PRE(user_attributes->type == BT_VALUE_TYPE_MAP, - "User attributes object is not a map value object."); + BT_ASSERT_PRE_CLK_CLS_NON_NULL(clock_class); + BT_ASSERT_PRE_USER_ATTRS_NON_NULL(user_attributes); + BT_ASSERT_PRE_USER_ATTRS_IS_MAP(user_attributes); BT_ASSERT_PRE_DEV_CLOCK_CLASS_HOT(clock_class); bt_object_put_ref_no_null_check(clock_class->user_attributes); clock_class->user_attributes = (void *) user_attributes; diff --git a/src/lib/trace-ir/clock-snapshot.c b/src/lib/trace-ir/clock-snapshot.c index 65d152f9..3006ff57 100644 --- a/src/lib/trace-ir/clock-snapshot.c +++ b/src/lib/trace-ir/clock-snapshot.c @@ -120,7 +120,7 @@ void bt_clock_snapshot_recycle(struct bt_clock_snapshot *clock_snapshot) uint64_t bt_clock_snapshot_get_value( const struct bt_clock_snapshot *clock_snapshot) { - BT_ASSERT_PRE_DEV_NON_NULL(clock_snapshot, "Clock snapshot"); + BT_ASSERT_PRE_DEV_CS_NON_NULL(clock_snapshot); BT_ASSERT_PRE_DEV(clock_snapshot->is_set, "Clock snapshot is not set: %!+k", clock_snapshot); return clock_snapshot->value_cycles; @@ -134,7 +134,7 @@ bt_clock_snapshot_get_ns_from_origin( int ret = BT_FUNC_STATUS_OK; BT_ASSERT_PRE_DEV_NO_ERROR(); - BT_ASSERT_PRE_DEV_NON_NULL(clock_snapshot, "Clock snapshot"); + BT_ASSERT_PRE_DEV_CS_NON_NULL(clock_snapshot); BT_ASSERT_PRE_DEV_NON_NULL(ret_value_ns, "Value (ns) (output)"); BT_ASSERT_PRE_DEV(clock_snapshot->is_set, "Clock snapshot is not set: %!+k", clock_snapshot); @@ -157,6 +157,6 @@ end: const struct bt_clock_class *bt_clock_snapshot_borrow_clock_class_const( const struct bt_clock_snapshot *clock_snapshot) { - BT_ASSERT_PRE_DEV_NON_NULL(clock_snapshot, "Clock snapshot"); + BT_ASSERT_PRE_DEV_CS_NON_NULL(clock_snapshot); return clock_snapshot->clock_class; } diff --git a/src/lib/trace-ir/event-class.c b/src/lib/trace-ir/event-class.c index 49c78fde..c520a837 100644 --- a/src/lib/trace-ir/event-class.c +++ b/src/lib/trace-ir/event-class.c @@ -33,7 +33,7 @@ #include "utils.h" #include "lib/func-status.h" -#define BT_ASSERT_PRE_DEV_EVENT_CLASS_HOT(_ec) \ +#define BT_ASSERT_PRE_DEV_EVENT_CLASS_HOT(_ec) \ BT_ASSERT_PRE_DEV_HOT(((const struct bt_event_class *) (_ec)), \ "Event class", ": %!+E", (_ec)) @@ -162,7 +162,7 @@ struct bt_event_class *bt_event_class_create( struct bt_stream_class *stream_class) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class"); + BT_ASSERT_PRE_SC_NON_NULL(stream_class); BT_ASSERT_PRE(stream_class->assigns_automatic_event_class_id, "Stream class does not automatically assigns event class IDs: " "%![sc-]+S", stream_class); @@ -182,7 +182,7 @@ struct bt_event_class *bt_event_class_create_with_id( const char *bt_event_class_get_name(const struct bt_event_class *event_class) { - BT_ASSERT_PRE_DEV_NON_NULL(event_class, "Event class"); + BT_ASSERT_PRE_DEV_EC_NON_NULL(event_class); return event_class->name.value; } @@ -190,8 +190,8 @@ enum bt_event_class_set_name_status bt_event_class_set_name( struct bt_event_class *event_class, const char *name) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(event_class, "Event class"); - BT_ASSERT_PRE_NON_NULL(name, "Name"); + BT_ASSERT_PRE_EC_NON_NULL(event_class); + BT_ASSERT_PRE_NAME_NON_NULL(name); BT_ASSERT_PRE_DEV_EVENT_CLASS_HOT(event_class); g_string_assign(event_class->name.str, name); event_class->name.value = event_class->name.str->str; @@ -201,7 +201,7 @@ enum bt_event_class_set_name_status bt_event_class_set_name( uint64_t bt_event_class_get_id(const struct bt_event_class *event_class) { - BT_ASSERT_PRE_DEV_NON_NULL(event_class, "Event class"); + BT_ASSERT_PRE_DEV_EC_NON_NULL(event_class); return event_class->id; } @@ -209,7 +209,7 @@ enum bt_property_availability bt_event_class_get_log_level( const struct bt_event_class *event_class, enum bt_event_class_log_level *log_level) { - BT_ASSERT_PRE_DEV_NON_NULL(event_class, "Event class"); + BT_ASSERT_PRE_DEV_EC_NON_NULL(event_class); BT_ASSERT_PRE_DEV_NON_NULL(log_level, "Log level (output)"); *log_level = (enum bt_event_class_log_level) event_class->log_level.value; @@ -220,7 +220,7 @@ void bt_event_class_set_log_level( struct bt_event_class *event_class, enum bt_event_class_log_level log_level) { - BT_ASSERT_PRE_NON_NULL(event_class, "Event class"); + BT_ASSERT_PRE_EC_NON_NULL(event_class); BT_ASSERT_PRE_DEV_EVENT_CLASS_HOT(event_class); bt_property_uint_set(&event_class->log_level, (uint64_t) log_level); @@ -229,7 +229,7 @@ void bt_event_class_set_log_level( const char *bt_event_class_get_emf_uri(const struct bt_event_class *event_class) { - BT_ASSERT_PRE_DEV_NON_NULL(event_class, "Event class"); + BT_ASSERT_PRE_DEV_EC_NON_NULL(event_class); return event_class->emf_uri.value; } @@ -238,7 +238,7 @@ enum bt_event_class_set_emf_uri_status bt_event_class_set_emf_uri( const char *emf_uri) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(event_class, "Event class"); + BT_ASSERT_PRE_EC_NON_NULL(event_class); BT_ASSERT_PRE_NON_NULL(emf_uri, "EMF URI"); BT_ASSERT_PRE_DEV_EVENT_CLASS_HOT(event_class); g_string_assign(event_class->emf_uri.str, emf_uri); @@ -250,7 +250,7 @@ enum bt_event_class_set_emf_uri_status bt_event_class_set_emf_uri( struct bt_stream_class *bt_event_class_borrow_stream_class( struct bt_event_class *event_class) { - BT_ASSERT_PRE_DEV_NON_NULL(event_class, "Event class"); + BT_ASSERT_PRE_DEV_EC_NON_NULL(event_class); return bt_event_class_borrow_stream_class_inline(event_class); } @@ -265,7 +265,7 @@ const struct bt_field_class * bt_event_class_borrow_specific_context_field_class_const( const struct bt_event_class *event_class) { - BT_ASSERT_PRE_DEV_NON_NULL(event_class, "Event class"); + BT_ASSERT_PRE_DEV_EC_NON_NULL(event_class); return event_class->specific_context_fc; } @@ -273,7 +273,7 @@ struct bt_field_class * bt_event_class_borrow_specific_context_field_class( struct bt_event_class *event_class) { - BT_ASSERT_PRE_DEV_NON_NULL(event_class, "Event class"); + BT_ASSERT_PRE_DEV_EC_NON_NULL(event_class); return event_class->specific_context_fc; } @@ -292,13 +292,10 @@ bt_event_class_set_specific_context_field_class( }; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(event_class, "Event class"); - BT_ASSERT_PRE_NON_NULL(field_class, "Field class"); + BT_ASSERT_PRE_EC_NON_NULL(event_class); + BT_ASSERT_PRE_FC_NON_NULL(field_class); BT_ASSERT_PRE_DEV_EVENT_CLASS_HOT(event_class); - BT_ASSERT_PRE(bt_field_class_get_type(field_class) == - BT_FIELD_CLASS_TYPE_STRUCTURE, - "Specific context field class is not a structure field class: " - "%!+F", field_class); + BT_ASSERT_PRE_FC_IS_STRUCT(field_class, "Specific context field class"); stream_class = bt_event_class_borrow_stream_class_inline( event_class); resolve_ctx.packet_context = stream_class->packet_context_fc; @@ -331,14 +328,14 @@ end: const struct bt_field_class *bt_event_class_borrow_payload_field_class_const( const struct bt_event_class *event_class) { - BT_ASSERT_PRE_DEV_NON_NULL(event_class, "Event class"); + BT_ASSERT_PRE_DEV_EC_NON_NULL(event_class); return event_class->payload_fc; } struct bt_field_class *bt_event_class_borrow_payload_field_class( struct bt_event_class *event_class) { - BT_ASSERT_PRE_DEV_NON_NULL(event_class, "Event class"); + BT_ASSERT_PRE_DEV_EC_NON_NULL(event_class); return event_class->payload_fc; } @@ -357,13 +354,10 @@ bt_event_class_set_payload_field_class( }; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(event_class, "Event class"); - BT_ASSERT_PRE_NON_NULL(field_class, "Field class"); + BT_ASSERT_PRE_EC_NON_NULL(event_class); + BT_ASSERT_PRE_FC_NON_NULL(field_class); BT_ASSERT_PRE_DEV_EVENT_CLASS_HOT(event_class); - BT_ASSERT_PRE(bt_field_class_get_type(field_class) == - BT_FIELD_CLASS_TYPE_STRUCTURE, - "Payload field class is not a structure field class: %!+F", - field_class); + BT_ASSERT_PRE_FC_IS_STRUCT(field_class, "Payload field class"); stream_class = bt_event_class_borrow_stream_class_inline( event_class); resolve_ctx.packet_context = stream_class->packet_context_fc; @@ -408,7 +402,7 @@ void _bt_event_class_freeze(const struct bt_event_class *event_class) const struct bt_value *bt_event_class_borrow_user_attributes_const( const struct bt_event_class *event_class) { - BT_ASSERT_PRE_DEV_NON_NULL(event_class, "Event class"); + BT_ASSERT_PRE_DEV_EC_NON_NULL(event_class); return event_class->user_attributes; } @@ -423,11 +417,10 @@ void bt_event_class_set_user_attributes( struct bt_event_class *event_class, const struct bt_value *user_attributes) { - BT_ASSERT_PRE_NON_NULL(event_class, "Event class"); - BT_ASSERT_PRE_NON_NULL(user_attributes, "User attributes"); - BT_ASSERT_PRE(user_attributes->type == BT_VALUE_TYPE_MAP, - "User attributes object is not a map value object."); + BT_ASSERT_PRE_EC_NON_NULL(event_class); BT_ASSERT_PRE_DEV_EVENT_CLASS_HOT(event_class); + BT_ASSERT_PRE_USER_ATTRS_NON_NULL(user_attributes); + BT_ASSERT_PRE_USER_ATTRS_IS_MAP(user_attributes); bt_object_put_ref_no_null_check(event_class->user_attributes); event_class->user_attributes = (void *) user_attributes; bt_object_get_ref_no_null_check(event_class->user_attributes); diff --git a/src/lib/trace-ir/event.c b/src/lib/trace-ir/event.c index b973798a..fe2c5805 100644 --- a/src/lib/trace-ir/event.c +++ b/src/lib/trace-ir/event.c @@ -121,7 +121,7 @@ end: struct bt_event_class *bt_event_borrow_class(struct bt_event *event) { - BT_ASSERT_PRE_DEV_NON_NULL(event, "Event"); + BT_ASSERT_PRE_DEV_EVENT_NON_NULL(event); return event->class; } @@ -133,7 +133,7 @@ const struct bt_event_class *bt_event_borrow_class_const( struct bt_stream *bt_event_borrow_stream(struct bt_event *event) { - BT_ASSERT_PRE_DEV_NON_NULL(event, "Event"); + BT_ASSERT_PRE_DEV_EVENT_NON_NULL(event); return event->stream; } @@ -145,40 +145,40 @@ const struct bt_stream *bt_event_borrow_stream_const( struct bt_field *bt_event_borrow_common_context_field(struct bt_event *event) { - BT_ASSERT_PRE_DEV_NON_NULL(event, "Event"); + BT_ASSERT_PRE_DEV_EVENT_NON_NULL(event); return event->common_context_field; } const struct bt_field *bt_event_borrow_common_context_field_const( const struct bt_event *event) { - BT_ASSERT_PRE_DEV_NON_NULL(event, "Event"); + BT_ASSERT_PRE_DEV_EVENT_NON_NULL(event); return event->common_context_field; } struct bt_field *bt_event_borrow_specific_context_field(struct bt_event *event) { - BT_ASSERT_PRE_DEV_NON_NULL(event, "Event"); + BT_ASSERT_PRE_DEV_EVENT_NON_NULL(event); return event->specific_context_field; } const struct bt_field *bt_event_borrow_specific_context_field_const( const struct bt_event *event) { - BT_ASSERT_PRE_DEV_NON_NULL(event, "Event"); + BT_ASSERT_PRE_DEV_EVENT_NON_NULL(event); return event->specific_context_field; } struct bt_field *bt_event_borrow_payload_field(struct bt_event *event) { - BT_ASSERT_PRE_DEV_NON_NULL(event, "Event"); + BT_ASSERT_PRE_DEV_EVENT_NON_NULL(event); return event->payload_field; } const struct bt_field *bt_event_borrow_payload_field_const( const struct bt_event *event) { - BT_ASSERT_PRE_DEV_NON_NULL(event, "Event"); + BT_ASSERT_PRE_DEV_EVENT_NON_NULL(event); return event->payload_field; } @@ -217,7 +217,7 @@ void bt_event_destroy(struct bt_event *event) struct bt_packet *bt_event_borrow_packet(struct bt_event *event) { - BT_ASSERT_PRE_DEV_NON_NULL(event, "Event"); + BT_ASSERT_PRE_DEV_EVENT_NON_NULL(event); return event->packet; } diff --git a/src/lib/trace-ir/field-class.c b/src/lib/trace-ir/field-class.c index 9b2f2613..5eb08146 100644 --- a/src/lib/trace-ir/field-class.c +++ b/src/lib/trace-ir/field-class.c @@ -34,7 +34,7 @@ enum bt_field_class_type bt_field_class_get_type( const struct bt_field_class *fc) { - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); return fc->type; } @@ -81,7 +81,7 @@ struct bt_field_class *bt_field_class_bit_array_create( struct bt_field_class_bit_array *ba_fc = NULL; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(trace_class, "Trace class"); + BT_ASSERT_PRE_TC_NON_NULL(trace_class); BT_ASSERT_PRE(length > 0 && length <= 64, "Unsupported length for bit array field class " "(minimum is 1, maximum is 64): length=%" PRIu64, length); @@ -113,7 +113,7 @@ uint64_t bt_field_class_bit_array_get_length(const struct bt_field_class *fc) { const struct bt_field_class_bit_array *ba_fc = (const void *) fc; - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); BT_ASSERT_PRE_DEV_FC_HAS_TYPE(fc, BT_FIELD_CLASS_TYPE_BIT_ARRAY, "Field class"); return ba_fc->length; @@ -134,7 +134,7 @@ struct bt_field_class *bt_field_class_bool_create( struct bt_field_class_bool *bool_fc = NULL; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(trace_class, "Trace class"); + BT_ASSERT_PRE_TC_NON_NULL(trace_class); BT_LOGD("Creating default boolean field class object."); bool_fc = g_new0(struct bt_field_class_bool, 1); if (!bool_fc) { @@ -192,7 +192,7 @@ struct bt_field_class *create_integer_field_class(bt_trace_class *trace_class, { struct bt_field_class_integer *int_fc = NULL; - BT_ASSERT_PRE_NON_NULL(trace_class, "Trace class"); + BT_ASSERT_PRE_TC_NON_NULL(trace_class); BT_LOGD("Creating default integer field class object: type=%s", bt_common_field_class_type_string(type)); int_fc = g_new0(struct bt_field_class_integer, 1); @@ -240,7 +240,7 @@ uint64_t bt_field_class_integer_get_field_value_range( { const struct bt_field_class_integer *int_fc = (const void *) fc; - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); BT_ASSERT_PRE_DEV_FC_IS_INT(fc, "Field class"); return int_fc->range; } @@ -258,7 +258,7 @@ void bt_field_class_integer_set_field_value_range( { struct bt_field_class_integer *int_fc = (void *) fc; - BT_ASSERT_PRE_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_FC_NON_NULL(fc); BT_ASSERT_PRE_FC_IS_INT(fc, "Field class"); BT_ASSERT_PRE_DEV_FC_HOT(fc, "Field class"); BT_ASSERT_PRE(size >= 1 && size <= 64, @@ -280,7 +280,7 @@ bt_field_class_integer_get_preferred_display_base(const struct bt_field_class *f { const struct bt_field_class_integer *int_fc = (const void *) fc; - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); BT_ASSERT_PRE_DEV_FC_IS_INT(fc, "Field class"); return int_fc->base; } @@ -291,7 +291,7 @@ void bt_field_class_integer_set_preferred_display_base( { struct bt_field_class_integer *int_fc = (void *) fc; - BT_ASSERT_PRE_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_FC_NON_NULL(fc); BT_ASSERT_PRE_FC_IS_INT(fc, "Field class"); BT_ASSERT_PRE_DEV_FC_HOT(fc, "Field class"); int_fc->base = base; @@ -347,7 +347,7 @@ struct bt_field_class *create_enumeration_field_class( { struct bt_field_class_enumeration *enum_fc = NULL; - BT_ASSERT_PRE_NON_NULL(trace_class, "Trace class"); + BT_ASSERT_PRE_TC_NON_NULL(trace_class); BT_LOGD("Creating default enumeration field class object: type=%s", bt_common_field_class_type_string(type)); enum_fc = g_new0(struct bt_field_class_enumeration, 1); @@ -408,7 +408,7 @@ uint64_t bt_field_class_enumeration_get_mapping_count( { const struct bt_field_class_enumeration *enum_fc = (const void *) fc; - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); BT_ASSERT_PRE_DEV_FC_IS_ENUM(fc, "Field class"); return (uint64_t) enum_fc->mappings->len; } @@ -419,7 +419,7 @@ bt_field_class_enumeration_unsigned_borrow_mapping_by_index_const( { const struct bt_field_class_enumeration *enum_fc = (const void *) fc; - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); BT_ASSERT_PRE_DEV_VALID_INDEX(index, enum_fc->mappings->len); BT_ASSERT_PRE_DEV_FC_HAS_TYPE(fc, BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION, "Field class"); @@ -432,7 +432,7 @@ bt_field_class_enumeration_signed_borrow_mapping_by_index_const( { const struct bt_field_class_enumeration *enum_fc = (const void *) fc; - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); BT_ASSERT_PRE_DEV_VALID_INDEX(index, enum_fc->mappings->len); BT_ASSERT_PRE_DEV_FC_HAS_TYPE(fc, BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION, "Field class"); @@ -468,7 +468,7 @@ const struct bt_field_class_enumeration_signed_mapping * bt_field_class_enumeration_signed_borrow_mapping_by_label_const( const struct bt_field_class *fc, const char *label) { - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); BT_ASSERT_PRE_DEV_FC_HAS_TYPE(fc, BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION, "Field class"); return (const void *) borrow_enumeration_field_class_mapping_by_label( @@ -479,7 +479,7 @@ const struct bt_field_class_enumeration_unsigned_mapping * bt_field_class_enumeration_unsigned_borrow_mapping_by_label_const( const struct bt_field_class *fc, const char *label) { - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); BT_ASSERT_PRE_DEV_FC_HAS_TYPE(fc, BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION, "Field class"); return (const void *) borrow_enumeration_field_class_mapping_by_label( @@ -525,7 +525,7 @@ bt_field_class_enumeration_unsigned_get_mapping_labels_for_value( uint64_t i; BT_ASSERT_PRE_DEV_NO_ERROR(); - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); BT_ASSERT_PRE_DEV_NON_NULL(label_array, "Label array (output)"); BT_ASSERT_PRE_DEV_NON_NULL(count, "Count (output)"); BT_ASSERT_PRE_DEV_FC_HAS_TYPE(fc, BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION, @@ -566,7 +566,7 @@ bt_field_class_enumeration_signed_get_mapping_labels_for_value( uint64_t i; BT_ASSERT_PRE_DEV_NO_ERROR(); - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); BT_ASSERT_PRE_DEV_NON_NULL(label_array, "Label array (output)"); BT_ASSERT_PRE_DEV_NON_NULL(count, "Count (output)"); BT_ASSERT_PRE_DEV_FC_HAS_TYPE(fc, BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION, @@ -635,7 +635,7 @@ add_mapping_to_enumeration_field_class(struct bt_field_class *fc, BT_ASSERT_PRE_NO_ERROR(); BT_ASSERT(fc); BT_ASSERT_PRE_NON_NULL(label, "Label"); - BT_ASSERT_PRE_NON_NULL(range_set, "Integer range set"); + BT_ASSERT_PRE_INT_RANGE_SET_NON_NULL(range_set); BT_ASSERT_PRE(!enumeration_field_class_has_mapping_with_label( enum_fc, label), "Duplicate mapping name in enumeration field class: " @@ -663,7 +663,7 @@ bt_field_class_enumeration_unsigned_add_mapping( const struct bt_integer_range_set_unsigned *range_set) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_FC_NON_NULL(fc); BT_ASSERT_PRE_FC_HAS_TYPE(fc, BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION, "Field class"); return add_mapping_to_enumeration_field_class(fc, label, @@ -676,7 +676,7 @@ bt_field_class_enumeration_signed_add_mapping( const struct bt_integer_range_set_signed *range_set) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_FC_NON_NULL(fc); BT_ASSERT_PRE_FC_HAS_TYPE(fc, BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION, "Field class"); return add_mapping_to_enumeration_field_class(fc, label, @@ -698,7 +698,7 @@ struct bt_field_class *create_real_field_class(bt_trace_class *trace_class, { struct bt_field_class_real *real_fc = NULL; - BT_ASSERT_PRE_NON_NULL(trace_class, "Trace class"); + BT_ASSERT_PRE_TC_NON_NULL(trace_class); BT_LOGD("Creating default real field class object: type=%s", bt_common_field_class_type_string(type)); real_fc = g_new0(struct bt_field_class_real, 1); @@ -849,7 +849,7 @@ struct bt_field_class *bt_field_class_structure_create( struct bt_field_class_structure *struct_fc = NULL; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(trace_class, "Trace class"); + BT_ASSERT_PRE_TC_NON_NULL(trace_class); BT_LOGD_STR("Creating default structure field class object."); struct_fc = g_new0(struct bt_field_class_structure, 1); if (!struct_fc) { @@ -1004,7 +1004,7 @@ bt_field_class_structure_append_member( struct bt_named_field_class *named_fc = NULL; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_FC_NON_NULL(fc); BT_ASSERT_PRE_FC_HAS_TYPE(fc, BT_FIELD_CLASS_TYPE_STRUCTURE, "Field class"); named_fc = create_named_field_class(name, member_fc); @@ -1030,7 +1030,7 @@ uint64_t bt_field_class_structure_get_member_count( { struct bt_field_class_structure *struct_fc = (void *) fc; - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); BT_ASSERT_PRE_DEV_FC_HAS_TYPE(fc, BT_FIELD_CLASS_TYPE_STRUCTURE, "Field class"); return (uint64_t) struct_fc->common.named_fcs->len; @@ -1051,7 +1051,7 @@ const struct bt_field_class_structure_member * bt_field_class_structure_borrow_member_by_index_const( const struct bt_field_class *fc, uint64_t index) { - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); BT_ASSERT_PRE_DEV_FC_HAS_TYPE(fc, BT_FIELD_CLASS_TYPE_STRUCTURE, "Field class"); return (const void *) @@ -1063,7 +1063,7 @@ struct bt_field_class_structure_member * bt_field_class_structure_borrow_member_by_index( struct bt_field_class *fc, uint64_t index) { - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); BT_ASSERT_PRE_DEV_FC_HAS_TYPE(fc, BT_FIELD_CLASS_TYPE_STRUCTURE, "Field class"); return (void *) @@ -1082,7 +1082,7 @@ borrow_named_field_class_from_container_field_class_by_name( gpointer value; BT_ASSERT_DBG(fc); - BT_ASSERT_PRE_DEV_NON_NULL(name, "Name"); + BT_ASSERT_PRE_DEV_NAME_NON_NULL(name); if (!g_hash_table_lookup_extended(fc->name_to_index, name, &orig_key, &value)) { goto end; @@ -1098,7 +1098,7 @@ const struct bt_field_class_structure_member * bt_field_class_structure_borrow_member_by_name_const( const struct bt_field_class *fc, const char *name) { - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); BT_ASSERT_PRE_DEV_FC_HAS_TYPE(fc, BT_FIELD_CLASS_TYPE_STRUCTURE, "Field class"); return (const void *) @@ -1110,7 +1110,7 @@ struct bt_field_class_structure_member * bt_field_class_structure_borrow_member_by_name( struct bt_field_class *fc, const char *name) { - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); BT_ASSERT_PRE_DEV_FC_HAS_TYPE(fc, BT_FIELD_CLASS_TYPE_STRUCTURE, "Field class"); return (void *) @@ -1123,7 +1123,7 @@ const char *bt_field_class_structure_member_get_name( { const struct bt_named_field_class *named_fc = (const void *) member; - BT_ASSERT_PRE_DEV_NON_NULL(member, "Structure field class member"); + BT_ASSERT_PRE_DEV_STRUCT_FC_MEMBER_NON_NULL(member); return named_fc->name->str; } @@ -1133,7 +1133,7 @@ bt_field_class_structure_member_borrow_field_class_const( { const struct bt_named_field_class *named_fc = (const void *) member; - BT_ASSERT_PRE_DEV_NON_NULL(member, "Structure field class member"); + BT_ASSERT_PRE_DEV_STRUCT_FC_MEMBER_NON_NULL(member); return named_fc->fc; } @@ -1143,7 +1143,7 @@ bt_field_class_structure_member_borrow_field_class( { struct bt_named_field_class *named_fc = (void *) member; - BT_ASSERT_PRE_DEV_NON_NULL(member, "Structure field class member"); + BT_ASSERT_PRE_DEV_STRUCT_FC_MEMBER_NON_NULL(member); return named_fc->fc; } @@ -1188,7 +1188,7 @@ struct bt_field_class *create_option_field_class( { struct bt_field_class_option *opt_fc = NULL; - BT_ASSERT_PRE_NON_NULL(trace_class, "Trace class"); + BT_ASSERT_PRE_TC_NON_NULL(trace_class); BT_ASSERT_PRE_NON_NULL(content_fc, "Content field class"); BT_LIB_LOGD("Creating option field class: " "type=%s, %![content-fc-]+F, %![sel-fc-]+F", @@ -1292,7 +1292,7 @@ bt_field_class_option_with_selector_field_integer_unsigned_create( (const void *) u_range_set; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(range_set, "Integer range set"); + BT_ASSERT_PRE_INT_RANGE_SET_NON_NULL(range_set); BT_ASSERT_PRE(range_set->ranges->len > 0, "Integer range set is empty: %!+R", range_set); fc = (void *) create_option_field_class(trace_class, @@ -1323,7 +1323,7 @@ bt_field_class_option_with_selector_field_integer_signed_create( (const void *) i_range_set; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(range_set, "Integer range set"); + BT_ASSERT_PRE_INT_RANGE_SET_NON_NULL(range_set); BT_ASSERT_PRE(range_set->ranges->len > 0, "Integer range set is empty: %!+R", range_set); fc = (void *) create_option_field_class(trace_class, @@ -1347,7 +1347,7 @@ const struct bt_field_class *bt_field_class_option_borrow_field_class_const( { struct bt_field_class_option *opt_fc = (void *) fc; - BT_ASSERT_PRE_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_FC_NON_NULL(fc); BT_ASSERT_PRE_FC_IS_OPTION(fc, "Field class"); return opt_fc->content_fc; } @@ -1357,7 +1357,7 @@ struct bt_field_class *bt_field_class_option_borrow_field_class( { struct bt_field_class_option *opt_fc = (void *) fc; - BT_ASSERT_PRE_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_FC_NON_NULL(fc); BT_ASSERT_PRE_FC_IS_OPTION(fc, "Field class"); return opt_fc->content_fc; } @@ -1369,7 +1369,7 @@ bt_field_class_option_with_selector_field_borrow_selector_field_path_const( const struct bt_field_class_option_with_selector_field *opt_fc = (const void *) fc; - BT_ASSERT_PRE_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_FC_NON_NULL(fc); BT_ASSERT_PRE_FC_IS_OPTION_WITH_SEL(fc, "Field class"); return opt_fc->selector_field_path; } @@ -1379,7 +1379,7 @@ void bt_field_class_option_with_selector_field_bool_set_selector_is_reversed( { struct bt_field_class_option_with_selector_field_bool *opt_fc = (void *) fc; - BT_ASSERT_PRE_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_FC_NON_NULL(fc); BT_ASSERT_PRE_FC_HAS_TYPE(fc, BT_FIELD_CLASS_TYPE_OPTION_WITH_BOOL_SELECTOR_FIELD, "Field class"); BT_ASSERT_PRE_DEV_FC_HOT(fc, "Field class"); @@ -1391,7 +1391,7 @@ bt_bool bt_field_class_option_with_selector_field_bool_selector_is_reversed( { struct bt_field_class_option_with_selector_field_bool *opt_fc = (void *) fc; - BT_ASSERT_PRE_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_FC_NON_NULL(fc); BT_ASSERT_PRE_FC_HAS_TYPE(fc, BT_FIELD_CLASS_TYPE_OPTION_WITH_BOOL_SELECTOR_FIELD, "Field class"); return opt_fc->sel_is_reversed; @@ -1404,7 +1404,7 @@ bt_field_class_option_with_selector_field_integer_unsigned_borrow_selector_range struct bt_field_class_option_with_selector_field_integer *opt_fc = (void *) fc; - BT_ASSERT_PRE_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_FC_NON_NULL(fc); BT_ASSERT_PRE_FC_IS_OPTION_WITH_INT_SEL(fc, "Field class"); return (const void *) opt_fc->range_set; } @@ -1416,7 +1416,7 @@ bt_field_class_option_with_selector_field_integer_signed_borrow_selector_ranges_ struct bt_field_class_option_with_selector_field_integer *opt_fc = (void *) fc; - BT_ASSERT_PRE_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_FC_NON_NULL(fc); BT_ASSERT_PRE_FC_IS_OPTION_WITH_INT_SEL(fc, "Field class"); return (const void *) opt_fc->range_set; } @@ -1463,7 +1463,7 @@ struct bt_field_class *bt_field_class_variant_create( enum bt_field_class_type fc_type; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(trace_class, "Trace class"); + BT_ASSERT_PRE_TC_NON_NULL(trace_class); if (selector_fc) { BT_ASSERT_PRE_FC_IS_INT(selector_fc, "Selector field class"); @@ -1541,8 +1541,8 @@ bt_field_class_variant_without_selector_append_option(struct bt_field_class *fc, struct bt_named_field_class *named_fc = NULL; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(fc, "Field class"); - BT_ASSERT_PRE_NON_NULL(name, "Name"); + BT_ASSERT_PRE_FC_NON_NULL(fc); + BT_ASSERT_PRE_NAME_NON_NULL(name); BT_ASSERT_PRE_NON_NULL(option_fc, "Option field class"); BT_ASSERT_PRE_FC_HAS_TYPE(fc, BT_FIELD_CLASS_TYPE_VARIANT_WITHOUT_SELECTOR_FIELD, "Field class"); @@ -1665,10 +1665,10 @@ int append_option_to_variant_with_selector_field_field_class( struct bt_field_class_variant_with_selector_field_option *opt = NULL; bool has_overlap; - BT_ASSERT_PRE_NON_NULL(fc, "Field class"); - BT_ASSERT_PRE_NON_NULL(name, "Name"); + BT_ASSERT_PRE_FC_NON_NULL(fc); + BT_ASSERT_PRE_NAME_NON_NULL(name); BT_ASSERT_PRE_NON_NULL(option_fc, "Option field class"); - BT_ASSERT_PRE_NON_NULL(range_set, "Integer range set"); + BT_ASSERT_PRE_INT_RANGE_SET_NON_NULL(range_set); BT_ASSERT_PRE_FC_HAS_TYPE(fc, expected_type, "Field class"); BT_ASSERT_PRE(range_set->ranges->len > 0, "Integer range set is empty: %!+R", range_set); @@ -1735,7 +1735,7 @@ uint64_t bt_field_class_variant_get_option_count(const struct bt_field_class *fc { const struct bt_field_class_variant *var_fc = (const void *) fc; - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); BT_ASSERT_PRE_DEV_FC_IS_VARIANT(fc, "Field class"); return (uint64_t) var_fc->common.named_fcs->len; } @@ -1744,7 +1744,7 @@ const struct bt_field_class_variant_option * bt_field_class_variant_borrow_option_by_name_const( const struct bt_field_class *fc, const char *name) { - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); BT_ASSERT_PRE_DEV_FC_IS_VARIANT(fc, "Field class"); return (const void *) borrow_named_field_class_from_container_field_class_by_name( @@ -1755,7 +1755,7 @@ const struct bt_field_class_variant_option * bt_field_class_variant_borrow_option_by_index_const( const struct bt_field_class *fc, uint64_t index) { - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); BT_ASSERT_PRE_DEV_FC_IS_VARIANT(fc, "Field class"); return (const void *) borrow_named_field_class_from_container_field_class_at_index( @@ -1766,7 +1766,7 @@ struct bt_field_class_variant_option * bt_field_class_variant_borrow_option_by_name( struct bt_field_class *fc, const char *name) { - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); BT_ASSERT_PRE_DEV_FC_IS_VARIANT(fc, "Field class"); return (void *) borrow_named_field_class_from_container_field_class_by_name( @@ -1777,7 +1777,7 @@ struct bt_field_class_variant_option * bt_field_class_variant_borrow_option_by_index( struct bt_field_class *fc, uint64_t index) { - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); BT_ASSERT_PRE_DEV_FC_IS_VARIANT(fc, "Field class"); return (void *) borrow_named_field_class_from_container_field_class_at_index( @@ -1788,7 +1788,7 @@ const struct bt_field_class_variant_with_selector_field_integer_unsigned_option bt_field_class_variant_with_selector_field_integer_unsigned_borrow_option_by_name_const( const struct bt_field_class *fc, const char *name) { - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); BT_ASSERT_PRE_DEV_FC_HAS_TYPE(fc, BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD, "Field class"); @@ -1801,7 +1801,7 @@ const struct bt_field_class_variant_with_selector_field_integer_unsigned_option bt_field_class_variant_with_selector_field_integer_unsigned_borrow_option_by_index_const( const struct bt_field_class *fc, uint64_t index) { - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); BT_ASSERT_PRE_DEV_FC_HAS_TYPE(fc, BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD, "Field class"); @@ -1814,7 +1814,7 @@ const struct bt_field_class_variant_with_selector_field_integer_signed_option * bt_field_class_variant_with_selector_field_integer_signed_borrow_option_by_name_const( const struct bt_field_class *fc, const char *name) { - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); BT_ASSERT_PRE_DEV_FC_HAS_TYPE(fc, BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_INTEGER_SELECTOR_FIELD, "Field class"); @@ -1827,7 +1827,7 @@ const struct bt_field_class_variant_with_selector_field_integer_signed_option * bt_field_class_variant_with_selector_field_integer_signed_borrow_option_by_index_const( const struct bt_field_class *fc, uint64_t index) { - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); BT_ASSERT_PRE_DEV_FC_HAS_TYPE(fc, BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_INTEGER_SELECTOR_FIELD, "Field class"); @@ -1841,7 +1841,7 @@ const char *bt_field_class_variant_option_get_name( { const struct bt_named_field_class *named_fc = (const void *) option; - BT_ASSERT_PRE_DEV_NON_NULL(option, "Variant field class option"); + BT_ASSERT_PRE_DEV_VAR_FC_OPT_NON_NULL(option); return named_fc->name->str; } @@ -1851,7 +1851,7 @@ bt_field_class_variant_option_borrow_field_class_const( { const struct bt_named_field_class *named_fc = (const void *) option; - BT_ASSERT_PRE_DEV_NON_NULL(option, "Variant field class option"); + BT_ASSERT_PRE_DEV_VAR_FC_OPT_NON_NULL(option); return named_fc->fc; } @@ -1861,7 +1861,7 @@ bt_field_class_variant_option_borrow_field_class( { struct bt_named_field_class *named_fc = (void *) option; - BT_ASSERT_PRE_DEV_NON_NULL(option, "Variant field class option"); + BT_ASSERT_PRE_DEV_VAR_FC_OPT_NON_NULL(option); return named_fc->fc; } @@ -1872,7 +1872,7 @@ bt_field_class_variant_with_selector_field_integer_unsigned_option_borrow_ranges const struct bt_field_class_variant_with_selector_field_option *opt = (const void *) option; - BT_ASSERT_PRE_DEV_NON_NULL(option, "Variant field class option"); + BT_ASSERT_PRE_DEV_VAR_FC_OPT_NON_NULL(option); return (const void *) opt->range_set; } @@ -1883,7 +1883,7 @@ bt_field_class_variant_with_selector_field_integer_signed_option_borrow_ranges_c const struct bt_field_class_variant_with_selector_field_option *opt = (const void *) option; - BT_ASSERT_PRE_DEV_NON_NULL(option, "Variant field class option"); + BT_ASSERT_PRE_DEV_VAR_FC_OPT_NON_NULL(option); return (const void *) opt->range_set; } @@ -1894,7 +1894,7 @@ bt_field_class_variant_with_selector_field_borrow_selector_field_path_const( const struct bt_field_class_variant_with_selector_field *var_fc = (const void *) fc; - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); BT_ASSERT_PRE_DEV_FC_IS_VARIANT_WITH_SEL(fc, "Field class"); return var_fc->selector_field_path; } @@ -1945,7 +1945,7 @@ bt_field_class_array_static_create(bt_trace_class *trace_class, struct bt_field_class_array_static *array_fc = NULL; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(trace_class, "Trace class"); + BT_ASSERT_PRE_TC_NON_NULL(trace_class); BT_ASSERT_PRE_NON_NULL(element_fc, "Element field class"); BT_LOGD_STR("Creating default static array field class object."); array_fc = g_new0(struct bt_field_class_array_static, 1); @@ -1978,7 +1978,7 @@ bt_field_class_array_borrow_element_field_class_const( { const struct bt_field_class_array *array_fc = (const void *) fc; - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); BT_ASSERT_PRE_DEV_FC_IS_ARRAY(fc, "Field class"); return array_fc->element_fc; } @@ -1988,7 +1988,7 @@ bt_field_class_array_borrow_element_field_class(struct bt_field_class *fc) { struct bt_field_class_array *array_fc = (void *) fc; - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); BT_ASSERT_PRE_DEV_FC_IS_ARRAY(fc, "Field class"); return array_fc->element_fc; } @@ -1997,7 +1997,7 @@ uint64_t bt_field_class_array_static_get_length(const struct bt_field_class *fc) { const struct bt_field_class_array_static *array_fc = (const void *) fc; - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); BT_ASSERT_PRE_DEV_FC_HAS_TYPE(fc, BT_FIELD_CLASS_TYPE_STATIC_ARRAY, "Field class"); return (uint64_t) array_fc->length; @@ -2026,7 +2026,7 @@ struct bt_field_class *bt_field_class_array_dynamic_create( struct bt_field_class_array_dynamic *array_fc = NULL; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(trace_class, "Trace class"); + BT_ASSERT_PRE_TC_NON_NULL(trace_class); BT_ASSERT_PRE_NON_NULL(element_fc, "Element field class"); BT_LOGD_STR("Creating default dynamic array field class object."); array_fc = g_new0(struct bt_field_class_array_dynamic, 1); @@ -2069,7 +2069,7 @@ bt_field_class_array_dynamic_with_length_field_borrow_length_field_path_const( const struct bt_field_class_array_dynamic *seq_fc = (const void *) fc; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); BT_ASSERT_PRE_DEV_FC_HAS_TYPE(fc, BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITH_LENGTH_FIELD, "Field class"); @@ -2090,7 +2090,7 @@ struct bt_field_class *bt_field_class_string_create(bt_trace_class *trace_class) struct bt_field_class_string *string_fc = NULL; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(trace_class, "Trace class"); + BT_ASSERT_PRE_TC_NON_NULL(trace_class); BT_LOGD_STR("Creating default string field class object."); string_fc = g_new0(struct bt_field_class_string, 1); if (!string_fc) { @@ -2186,7 +2186,7 @@ void bt_field_class_make_part_of_trace_class(const struct bt_field_class *c_fc) const struct bt_value *bt_field_class_borrow_user_attributes_const( const struct bt_field_class *fc) { - BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class"); + BT_ASSERT_PRE_DEV_FC_NON_NULL(fc); return fc->user_attributes; } @@ -2202,8 +2202,8 @@ void bt_field_class_set_user_attributes( struct bt_field_class *fc, const struct bt_value *user_attributes) { - BT_ASSERT_PRE_NON_NULL(fc, "Field class"); - BT_ASSERT_PRE_NON_NULL(user_attributes, "User attributes"); + BT_ASSERT_PRE_FC_NON_NULL(fc); + BT_ASSERT_PRE_USER_ATTRS_NON_NULL(user_attributes); BT_ASSERT_PRE(user_attributes->type == BT_VALUE_TYPE_MAP, "User attributes object is not a map value object."); BT_ASSERT_PRE_DEV_FC_HOT(fc, "Field class"); @@ -2224,9 +2224,8 @@ void bt_named_field_class_set_user_attributes( struct bt_named_field_class *named_fc, const struct bt_value *user_attributes) { - BT_ASSERT_PRE_NON_NULL(user_attributes, "User attributes"); - BT_ASSERT_PRE(user_attributes->type == BT_VALUE_TYPE_MAP, - "User attributes object is not a map value object."); + BT_ASSERT_PRE_USER_ATTRS_NON_NULL(user_attributes); + BT_ASSERT_PRE_USER_ATTRS_IS_MAP(user_attributes); BT_ASSERT_PRE_DEV_HOT(named_fc, "Structure field class member or variant field class option", "."); @@ -2239,7 +2238,7 @@ const struct bt_value * bt_field_class_structure_member_borrow_user_attributes_const( const struct bt_field_class_structure_member *member) { - BT_ASSERT_PRE_NON_NULL(member, "Structure field class member"); + BT_ASSERT_PRE_STRUCT_FC_MEMBER_NON_NULL(member); return bt_named_field_class_borrow_user_attributes_const( (const void *) member); } @@ -2248,7 +2247,7 @@ struct bt_value * bt_field_class_structure_member_borrow_user_attributes( struct bt_field_class_structure_member *member) { - BT_ASSERT_PRE_NON_NULL(member, "Structure field class member"); + BT_ASSERT_PRE_STRUCT_FC_MEMBER_NON_NULL(member); return (void *) bt_named_field_class_borrow_user_attributes_const( (void *) member); } @@ -2257,7 +2256,7 @@ void bt_field_class_structure_member_set_user_attributes( struct bt_field_class_structure_member *member, const struct bt_value *user_attributes) { - BT_ASSERT_PRE_NON_NULL(member, "Structure field class member"); + BT_ASSERT_PRE_STRUCT_FC_MEMBER_NON_NULL(member); bt_named_field_class_set_user_attributes((void *) member, user_attributes); } @@ -2265,7 +2264,7 @@ void bt_field_class_structure_member_set_user_attributes( const struct bt_value *bt_field_class_variant_option_borrow_user_attributes_const( const struct bt_field_class_variant_option *option) { - BT_ASSERT_PRE_NON_NULL(option, "Variant field class option"); + BT_ASSERT_PRE_VAR_FC_OPT_NON_NULL(option); return bt_named_field_class_borrow_user_attributes_const( (const void *) option); } @@ -2273,7 +2272,7 @@ const struct bt_value *bt_field_class_variant_option_borrow_user_attributes_cons struct bt_value *bt_field_class_variant_option_borrow_user_attributes( struct bt_field_class_variant_option *option) { - BT_ASSERT_PRE_NON_NULL(option, "Variant field class option"); + BT_ASSERT_PRE_VAR_FC_OPT_NON_NULL(option); return (void *) bt_named_field_class_borrow_user_attributes_const( (void *) option); } @@ -2282,7 +2281,7 @@ void bt_field_class_variant_option_set_user_attributes( struct bt_field_class_variant_option *option, const struct bt_value *user_attributes) { - BT_ASSERT_PRE_NON_NULL(option, "Variant field class option"); + BT_ASSERT_PRE_VAR_FC_OPT_NON_NULL(option); bt_named_field_class_set_user_attributes((void *) option, user_attributes); } diff --git a/src/lib/trace-ir/field-path.c b/src/lib/trace-ir/field-path.c index e1a76019..60e0aca9 100644 --- a/src/lib/trace-ir/field-path.c +++ b/src/lib/trace-ir/field-path.c @@ -66,20 +66,20 @@ end: enum bt_field_path_scope bt_field_path_get_root_scope( const struct bt_field_path *field_path) { - BT_ASSERT_PRE_DEV_NON_NULL(field_path, "Field path"); + BT_ASSERT_PRE_DEV_FP_NON_NULL(field_path); return field_path->root; } uint64_t bt_field_path_get_item_count(const struct bt_field_path *field_path) { - BT_ASSERT_PRE_DEV_NON_NULL(field_path, "Field path"); + BT_ASSERT_PRE_DEV_FP_NON_NULL(field_path); return (uint64_t) field_path->items->len; } const struct bt_field_path_item *bt_field_path_borrow_item_by_index_const( const struct bt_field_path *field_path, uint64_t index) { - BT_ASSERT_PRE_DEV_NON_NULL(field_path, "Field path"); + BT_ASSERT_PRE_DEV_FP_NON_NULL(field_path); BT_ASSERT_PRE_DEV_VALID_INDEX(index, field_path->items->len); return bt_field_path_borrow_item_by_index_inline(field_path, index); } diff --git a/src/lib/trace-ir/field.c b/src/lib/trace-ir/field.c index 6e513d41..b1d84867 100644 --- a/src/lib/trace-ir/field.c +++ b/src/lib/trace-ir/field.c @@ -22,9 +22,9 @@ #include "field-class.h" #include "lib/func-status.h" -#define BT_ASSERT_PRE_DEV_FIELD_HOT(_field, _name) \ - BT_ASSERT_PRE_DEV_HOT((const struct bt_field *) (_field), (_name), \ - ": %!+f", (_field)) +#define BT_ASSERT_PRE_DEV_FIELD_HOT(_field) \ + BT_ASSERT_PRE_DEV_HOT((const struct bt_field *) (_field), \ + "Field", ": %!+f", (_field)) static void reset_single_field(struct bt_field *field); @@ -193,20 +193,20 @@ void destroy_variant_field(struct bt_field *field); struct bt_field_class *bt_field_borrow_class(struct bt_field *field) { - BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_NON_NULL(field); return field->class; } const struct bt_field_class *bt_field_borrow_class_const( const struct bt_field *field) { - BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_NON_NULL(field); return field->class; } enum bt_field_class_type bt_field_get_class_type(const struct bt_field *field) { - BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_NON_NULL(field); return field->class->type; } @@ -624,8 +624,8 @@ bt_bool bt_field_bool_get_value(const struct bt_field *field) { const struct bt_field_bool *bool_field = (const void *) field; - BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); - BT_ASSERT_PRE_DEV_FIELD_IS_SET(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_NON_NULL(field); + BT_ASSERT_PRE_DEV_FIELD_IS_SET(field); BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_BOOL, "Field"); return (bt_bool) bool_field->value; @@ -635,10 +635,10 @@ void bt_field_bool_set_value(struct bt_field *field, bt_bool value) { struct bt_field_bool *bool_field = (void *) field; - BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_NON_NULL(field); BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_BOOL, "Field"); - BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_HOT(field); bool_field->value = (bool) value; bt_field_set_single(field, true); } @@ -647,8 +647,8 @@ uint64_t bt_field_bit_array_get_value_as_integer(const struct bt_field *field) { const struct bt_field_bit_array *ba_field = (const void *) field; - BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); - BT_ASSERT_PRE_DEV_FIELD_IS_SET(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_NON_NULL(field); + BT_ASSERT_PRE_DEV_FIELD_IS_SET(field); BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_BIT_ARRAY, "Field"); return ba_field->value_as_int; @@ -660,10 +660,10 @@ void bt_field_bit_array_set_value_as_integer(struct bt_field *field, struct bt_field_bit_array *ba_field = (void *) field; struct bt_field_class_bit_array *ba_fc; - BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_NON_NULL(field); BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_BIT_ARRAY, "Field"); - BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_HOT(field); ba_fc = (void *) field->class; ba_field->value_as_int = value; @@ -679,8 +679,8 @@ int64_t bt_field_integer_signed_get_value(const struct bt_field *field) { const struct bt_field_integer *int_field = (const void *) field; - BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); - BT_ASSERT_PRE_DEV_FIELD_IS_SET(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_NON_NULL(field); + BT_ASSERT_PRE_DEV_FIELD_IS_SET(field); BT_ASSERT_PRE_DEV_FIELD_IS_SIGNED_INT(field, "Field"); return int_field->value.i; } @@ -689,9 +689,9 @@ void bt_field_integer_signed_set_value(struct bt_field *field, int64_t value) { struct bt_field_integer *int_field = (void *) field; - BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_NON_NULL(field); BT_ASSERT_PRE_DEV_FIELD_IS_SIGNED_INT(field, "Field"); - BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_HOT(field); BT_ASSERT_PRE_DEV(bt_util_value_is_in_range_signed( ((struct bt_field_class_integer *) field->class)->range, value), "Value is out of bounds: value=%" PRId64 ", %![field-]+f, " @@ -704,8 +704,8 @@ uint64_t bt_field_integer_unsigned_get_value(const struct bt_field *field) { const struct bt_field_integer *int_field = (const void *) field; - BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); - BT_ASSERT_PRE_DEV_FIELD_IS_SET(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_NON_NULL(field); + BT_ASSERT_PRE_DEV_FIELD_IS_SET(field); BT_ASSERT_PRE_DEV_FIELD_IS_UNSIGNED_INT(field, "Field"); return int_field->value.u; } @@ -714,9 +714,9 @@ void bt_field_integer_unsigned_set_value(struct bt_field *field, uint64_t value) { struct bt_field_integer *int_field = (void *) field; - BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_NON_NULL(field); BT_ASSERT_PRE_DEV_FIELD_IS_UNSIGNED_INT(field, "Field"); - BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_HOT(field); BT_ASSERT_PRE_DEV(bt_util_value_is_in_range_unsigned( ((struct bt_field_class_integer *) field->class)->range, value), "Value is out of bounds: value=%" PRIu64 ", %![field-]+f, " @@ -729,8 +729,8 @@ float bt_field_real_single_precision_get_value(const struct bt_field *field) { const struct bt_field_real *real_field = (const void *) field; - BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); - BT_ASSERT_PRE_DEV_FIELD_IS_SET(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_NON_NULL(field); + BT_ASSERT_PRE_DEV_FIELD_IS_SET(field); BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_SINGLE_PRECISION_REAL, "Field"); return (float) real_field->value; @@ -740,8 +740,8 @@ double bt_field_real_double_precision_get_value(const struct bt_field *field) { const struct bt_field_real *real_field = (const void *) field; - BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); - BT_ASSERT_PRE_DEV_FIELD_IS_SET(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_NON_NULL(field); + BT_ASSERT_PRE_DEV_FIELD_IS_SET(field); BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_DOUBLE_PRECISION_REAL, "Field"); @@ -753,10 +753,10 @@ void bt_field_real_single_precision_set_value(struct bt_field *field, { struct bt_field_real *real_field = (void *) field; - BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_NON_NULL(field); BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_SINGLE_PRECISION_REAL, "Field"); - BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_HOT(field); real_field->value = (double) value; bt_field_set_single(field, true); @@ -767,10 +767,10 @@ void bt_field_real_double_precision_set_value(struct bt_field *field, { struct bt_field_real *real_field = (void *) field; - BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_NON_NULL(field); BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_DOUBLE_PRECISION_REAL, "Field"); - BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_HOT(field); real_field->value = value; bt_field_set_single(field, true); @@ -785,10 +785,10 @@ 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_FIELD_NON_NULL(field); BT_ASSERT_PRE_DEV_NON_NULL(label_array, "Label array (output)"); BT_ASSERT_PRE_DEV_NON_NULL(label_array, "Count (output)"); - BT_ASSERT_PRE_DEV_FIELD_IS_SET(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_IS_SET(field); BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION, "Field"); return (int) @@ -805,10 +805,10 @@ 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_FIELD_NON_NULL(field); BT_ASSERT_PRE_DEV_NON_NULL(label_array, "Label array (output)"); BT_ASSERT_PRE_DEV_NON_NULL(label_array, "Count (output)"); - BT_ASSERT_PRE_DEV_FIELD_IS_SET(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_IS_SET(field); BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION, "Field"); return (int) @@ -820,8 +820,8 @@ const char *bt_field_string_get_value(const struct bt_field *field) { const struct bt_field_string *string_field = (const void *) field; - BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); - BT_ASSERT_PRE_DEV_FIELD_IS_SET(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_NON_NULL(field); + BT_ASSERT_PRE_DEV_FIELD_IS_SET(field); BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_STRING, "Field"); return (const char *) string_field->buf->data; @@ -831,8 +831,8 @@ uint64_t bt_field_string_get_length(const struct bt_field *field) { const struct bt_field_string *string_field = (const void *) field; - BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); - BT_ASSERT_PRE_DEV_FIELD_IS_SET(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_NON_NULL(field); + BT_ASSERT_PRE_DEV_FIELD_IS_SET(field); BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_STRING, "Field"); return string_field->length; @@ -852,9 +852,9 @@ 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_FIELD_NON_NULL(field); BT_ASSERT_PRE_DEV_NON_NULL(value, "Value"); - BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_HOT(field); BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_STRING, "Field"); clear_string_field(field); @@ -879,9 +879,9 @@ enum bt_field_string_append_status bt_field_string_append_with_length( uint64_t new_length; BT_ASSERT_PRE_DEV_NO_ERROR(); - BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_NON_NULL(field); BT_ASSERT_PRE_DEV_NON_NULL(value, "Value"); - BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_HOT(field); BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_STRING, "Field"); @@ -906,8 +906,8 @@ enum bt_field_string_append_status bt_field_string_append_with_length( void bt_field_string_clear(struct bt_field *field) { - BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); - BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_NON_NULL(field); + BT_ASSERT_PRE_DEV_FIELD_HOT(field); BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_STRING, "Field"); clear_string_field(field); @@ -917,7 +917,7 @@ uint64_t bt_field_array_get_length(const struct bt_field *field) { const struct bt_field_array *array_field = (const void *) field; - BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_NON_NULL(field); BT_ASSERT_PRE_DEV_FIELD_IS_ARRAY(field, "Field"); return array_field->length; } @@ -929,9 +929,9 @@ enum bt_field_array_dynamic_set_length_status bt_field_array_dynamic_set_length( 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_NON_NULL(field); BT_ASSERT_PRE_DEV_FIELD_IS_DYNAMIC_ARRAY(field, "Field"); - BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_HOT(field); if (G_UNLIKELY(length > array_field->fields->len)) { /* Make more room */ @@ -973,7 +973,7 @@ struct bt_field *borrow_array_field_element_field_by_index( { struct bt_field_array *array_field = (void *) field; - BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_NON_NULL(field); BT_ASSERT_PRE_DEV_FIELD_IS_ARRAY(field, "Field"); BT_ASSERT_PRE_DEV_VALID_INDEX(index, array_field->length); return array_field->fields->pdata[index]; @@ -998,7 +998,7 @@ struct bt_field *borrow_structure_field_member_field_by_index( { struct bt_field_structure *struct_field = (void *) field; - BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_NON_NULL(field); BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_STRUCTURE, "Field"); BT_ASSERT_PRE_DEV_VALID_INDEX(index, struct_field->fields->len); @@ -1030,7 +1030,7 @@ struct bt_field *borrow_structure_field_member_field_by_name( gpointer orig_key; gpointer index; - BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_NON_NULL(field); BT_ASSERT_PRE_DEV_NON_NULL(name, "Field name"); BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_STRUCTURE, "Field"); @@ -1065,9 +1065,9 @@ 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_NON_NULL(field); BT_ASSERT_PRE_DEV_FIELD_IS_OPTION(field, "Field"); - BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_HOT(field); if (has_field) { opt_field->selected_field = opt_field->content_field; @@ -1080,7 +1080,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_NON_NULL(field); BT_ASSERT_PRE_DEV_FIELD_IS_OPTION(field, "Field"); return opt_field->selected_field; } @@ -1097,7 +1097,7 @@ struct bt_field *borrow_variant_field_selected_option_field( { struct bt_field_variant *var_field = (void *) field; - BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_NON_NULL(field); BT_ASSERT_PRE_DEV_FIELD_IS_VARIANT(field, "Field"); BT_ASSERT_PRE_DEV(var_field->selected_field, "Variant field has no selected field: %!+f", field); @@ -1134,7 +1134,7 @@ const struct bt_field_class_variant_option * bt_field_variant_borrow_selected_option_class_const( const struct bt_field *field) { - BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_NON_NULL(field); BT_ASSERT_PRE_DEV_FIELD_IS_VARIANT(field, "Field"); return borrow_variant_field_selected_class_option(field); } @@ -1143,7 +1143,7 @@ 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_NON_NULL(field); BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD, "Field"); return (const void *) borrow_variant_field_selected_class_option(field); @@ -1153,7 +1153,7 @@ 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_NON_NULL(field); BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_INTEGER_SELECTOR_FIELD, "Field"); return (const void *) borrow_variant_field_selected_class_option(field); @@ -1166,9 +1166,9 @@ bt_field_variant_select_option_by_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_NON_NULL(field); BT_ASSERT_PRE_DEV_FIELD_IS_VARIANT(field, "Field"); - BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_HOT(field); BT_ASSERT_PRE_DEV_VALID_INDEX(index, var_field->fields->len); var_field->selected_field = var_field->fields->pdata[index]; var_field->selected_index = index; @@ -1180,7 +1180,7 @@ uint64_t bt_field_variant_get_selected_option_index( { const struct bt_field_variant *var_field = (const void *) field; - BT_ASSERT_PRE_DEV_NON_NULL(field, "Field"); + BT_ASSERT_PRE_DEV_FIELD_NON_NULL(field); BT_ASSERT_PRE_DEV_FIELD_IS_VARIANT(field, "Field"); BT_ASSERT_PRE_DEV(var_field->selected_field, "Variant field has no selected field: %!+f", field); diff --git a/src/lib/trace-ir/packet.c b/src/lib/trace-ir/packet.c index 2b33bb80..18ed8fed 100644 --- a/src/lib/trace-ir/packet.c +++ b/src/lib/trace-ir/packet.c @@ -27,7 +27,7 @@ struct bt_stream *bt_packet_borrow_stream(struct bt_packet *packet) { - BT_ASSERT_PRE_DEV_NON_NULL(packet, "Packet"); + BT_ASSERT_PRE_DEV_PACKET_NON_NULL(packet); return packet->stream; } @@ -39,7 +39,7 @@ const struct bt_stream *bt_packet_borrow_stream_const( struct bt_field *bt_packet_borrow_context_field(struct bt_packet *packet) { - BT_ASSERT_PRE_DEV_NON_NULL(packet, "Packet"); + BT_ASSERT_PRE_DEV_PACKET_NON_NULL(packet); return packet->context_field ? packet->context_field->field : NULL; } @@ -203,7 +203,7 @@ struct bt_packet *bt_packet_create(const struct bt_stream *c_stream) struct bt_stream *stream = (void *) c_stream; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(stream, "Stream"); + BT_ASSERT_PRE_STREAM_NON_NULL(stream); BT_ASSERT_PRE(stream->class->supports_packets, "Stream class does not support packets: %![sc-]+S", stream->class); diff --git a/src/lib/trace-ir/stream-class.c b/src/lib/trace-ir/stream-class.c index f32d7bc2..2fe47615 100644 --- a/src/lib/trace-ir/stream-class.c +++ b/src/lib/trace-ir/stream-class.c @@ -31,7 +31,7 @@ #include "lib/value.h" #include "lib/func-status.h" -#define BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(_sc) \ +#define BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(_sc) \ BT_ASSERT_PRE_DEV_HOT((_sc), "Stream class", ": %!+S", (_sc)) static @@ -162,7 +162,7 @@ end: struct bt_stream_class *bt_stream_class_create(struct bt_trace_class *tc) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(tc, "Trace class"); + BT_ASSERT_PRE_TC_NON_NULL(tc); BT_ASSERT_PRE(tc->assigns_automatic_stream_class_id, "Trace class does not automatically assigns stream class IDs: " "%![sc-]+T", tc); @@ -174,7 +174,7 @@ struct bt_stream_class *bt_stream_class_create_with_id( struct bt_trace_class *tc, uint64_t id) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(tc, "Trace class"); + BT_ASSERT_PRE_TC_NON_NULL(tc); BT_ASSERT_PRE(!tc->assigns_automatic_stream_class_id, "Trace class automatically assigns stream class IDs: " "%![sc-]+T", tc); @@ -184,7 +184,7 @@ struct bt_stream_class *bt_stream_class_create_with_id( struct bt_trace_class *bt_stream_class_borrow_trace_class( struct bt_stream_class *stream_class) { - BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class"); + BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class); return bt_stream_class_borrow_trace_class_inline(stream_class); } @@ -196,7 +196,7 @@ const struct bt_trace_class *bt_stream_class_borrow_trace_class_const( const char *bt_stream_class_get_name(const struct bt_stream_class *stream_class) { - BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class"); + BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class); return stream_class->name.value; } @@ -205,8 +205,8 @@ enum bt_stream_class_set_name_status bt_stream_class_set_name( const char *name) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class"); - BT_ASSERT_PRE_NON_NULL(name, "Name"); + BT_ASSERT_PRE_SC_NON_NULL(stream_class); + BT_ASSERT_PRE_NAME_NON_NULL(name); BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class); g_string_assign(stream_class->name.str, name); stream_class->name.value = stream_class->name.str->str; @@ -216,21 +216,21 @@ enum bt_stream_class_set_name_status bt_stream_class_set_name( uint64_t bt_stream_class_get_id(const struct bt_stream_class *stream_class) { - BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class"); + BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class); return stream_class->id; } uint64_t bt_stream_class_get_event_class_count( const struct bt_stream_class *stream_class) { - BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class"); + BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class); return (uint64_t) stream_class->event_classes->len; } struct bt_event_class *bt_stream_class_borrow_event_class_by_index( struct bt_stream_class *stream_class, uint64_t index) { - BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class"); + BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class); BT_ASSERT_PRE_DEV_VALID_INDEX(index, stream_class->event_classes->len); return g_ptr_array_index(stream_class->event_classes, index); } @@ -249,7 +249,7 @@ struct bt_event_class *bt_stream_class_borrow_event_class_by_id( struct bt_event_class *event_class = NULL; uint64_t i; - BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class"); + BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class); for (i = 0; i < stream_class->event_classes->len; i++) { struct bt_event_class *event_class_candidate = @@ -277,7 +277,7 @@ const struct bt_field_class * bt_stream_class_borrow_packet_context_field_class_const( const struct bt_stream_class *stream_class) { - BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class"); + BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class); return stream_class->packet_context_fc; } @@ -285,7 +285,7 @@ struct bt_field_class * bt_stream_class_borrow_packet_context_field_class( struct bt_stream_class *stream_class) { - BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class"); + BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class); return stream_class->packet_context_fc; } @@ -303,16 +303,13 @@ bt_stream_class_set_packet_context_field_class( }; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class"); + BT_ASSERT_PRE_SC_NON_NULL(stream_class); BT_ASSERT_PRE(stream_class->supports_packets, "Stream class does not support packets: %![sc-]+S", stream_class); - BT_ASSERT_PRE_NON_NULL(field_class, "Field class"); + BT_ASSERT_PRE_FC_NON_NULL(field_class); BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class); - BT_ASSERT_PRE(bt_field_class_get_type(field_class) == - BT_FIELD_CLASS_TYPE_STRUCTURE, - "Packet context field class is not a structure field class: %!+F", - field_class); + BT_ASSERT_PRE_FC_IS_STRUCT(field_class, "Packet context field class"); ret = bt_resolve_field_paths(field_class, &resolve_ctx); if (ret) { /* @@ -340,7 +337,7 @@ const struct bt_field_class * bt_stream_class_borrow_event_common_context_field_class_const( const struct bt_stream_class *stream_class) { - BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class"); + BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class); return stream_class->event_common_context_fc; } @@ -348,7 +345,7 @@ struct bt_field_class * bt_stream_class_borrow_event_common_context_field_class( struct bt_stream_class *stream_class) { - BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class"); + BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class); return stream_class->event_common_context_fc; } @@ -366,13 +363,11 @@ bt_stream_class_set_event_common_context_field_class( }; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class"); - BT_ASSERT_PRE_NON_NULL(field_class, "Field class"); + BT_ASSERT_PRE_SC_NON_NULL(stream_class); + BT_ASSERT_PRE_FC_NON_NULL(field_class); BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class); - BT_ASSERT_PRE(bt_field_class_get_type(field_class) == - BT_FIELD_CLASS_TYPE_STRUCTURE, - "Event common context field class is not a structure field class: %!+F", - field_class); + BT_ASSERT_PRE_FC_IS_STRUCT(field_class, + "Event common context field class"); resolve_ctx.packet_context = stream_class->packet_context_fc; ret = bt_resolve_field_paths(field_class, &resolve_ctx); if (ret) { @@ -415,8 +410,8 @@ bt_stream_class_set_default_clock_class( struct bt_clock_class *clock_class) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class"); - BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class"); + BT_ASSERT_PRE_SC_NON_NULL(stream_class); + BT_ASSERT_PRE_CLK_CLS_NON_NULL(clock_class); BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class); bt_object_put_ref(stream_class->default_clock_class); stream_class->default_clock_class = clock_class; @@ -430,21 +425,21 @@ bt_stream_class_set_default_clock_class( struct bt_clock_class *bt_stream_class_borrow_default_clock_class( struct bt_stream_class *stream_class) { - BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class"); + BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class); return stream_class->default_clock_class; } const struct bt_clock_class *bt_stream_class_borrow_default_clock_class_const( const struct bt_stream_class *stream_class) { - BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class"); + BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class); return stream_class->default_clock_class; } bt_bool bt_stream_class_assigns_automatic_event_class_id( const struct bt_stream_class *stream_class) { - BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class"); + BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class); return (bt_bool) stream_class->assigns_automatic_event_class_id; } @@ -452,7 +447,7 @@ void bt_stream_class_set_assigns_automatic_event_class_id( struct bt_stream_class *stream_class, bt_bool value) { - BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class"); + BT_ASSERT_PRE_SC_NON_NULL(stream_class); BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class); stream_class->assigns_automatic_event_class_id = (bool) value; BT_LIB_LOGD("Set stream class's automatic event class ID " @@ -462,7 +457,7 @@ void bt_stream_class_set_assigns_automatic_event_class_id( bt_bool bt_stream_class_assigns_automatic_stream_id( const struct bt_stream_class *stream_class) { - BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class"); + BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class); return (bt_bool) stream_class->assigns_automatic_stream_id; } @@ -471,7 +466,7 @@ void bt_stream_class_set_supports_discarded_events( bt_bool supports_discarded_events, bt_bool with_default_clock_snapshots) { - BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class"); + BT_ASSERT_PRE_SC_NON_NULL(stream_class); BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class); BT_ASSERT_PRE(supports_discarded_events || !with_default_clock_snapshots, @@ -491,14 +486,14 @@ void bt_stream_class_set_supports_discarded_events( bt_bool bt_stream_class_supports_discarded_events( const struct bt_stream_class *stream_class) { - BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class"); + BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class); return (bt_bool) stream_class->supports_discarded_events; } bt_bool bt_stream_class_discarded_events_have_default_clock_snapshots( const struct bt_stream_class *stream_class) { - BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class"); + BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class); return (bt_bool) stream_class->discarded_events_have_default_clock_snapshots; } @@ -507,7 +502,7 @@ void bt_stream_class_set_supports_discarded_packets( bt_bool supports_discarded_packets, bt_bool with_default_clock_snapshots) { - BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class"); + BT_ASSERT_PRE_SC_NON_NULL(stream_class); BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class); BT_ASSERT_PRE(!supports_discarded_packets || stream_class->supports_packets, @@ -531,14 +526,14 @@ void bt_stream_class_set_supports_discarded_packets( bt_bool bt_stream_class_supports_discarded_packets( const struct bt_stream_class *stream_class) { - BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class"); + BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class); return (bt_bool) stream_class->supports_discarded_packets; } bt_bool bt_stream_class_discarded_packets_have_default_clock_snapshots( const struct bt_stream_class *stream_class) { - BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class"); + BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class); return (bt_bool) stream_class->discarded_packets_have_default_clock_snapshots; } @@ -551,7 +546,7 @@ void bt_stream_class_set_supports_packets( bt_bool with_default_clock_snapshot = with_beginning_default_clock_snapshot || with_end_default_clock_snapshot; - BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class"); + BT_ASSERT_PRE_SC_NON_NULL(stream_class); BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class); BT_ASSERT_PRE(supports_packets || !with_default_clock_snapshot, @@ -579,21 +574,21 @@ void bt_stream_class_set_supports_packets( bt_bool bt_stream_class_supports_packets( const struct bt_stream_class *stream_class) { - BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class"); + BT_ASSERT_PRE_SC_NON_NULL(stream_class); return (bt_bool) stream_class->supports_packets; } bt_bool bt_stream_class_packets_have_beginning_default_clock_snapshot( const struct bt_stream_class *stream_class) { - BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class"); + BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class); return (bt_bool) stream_class->packets_have_beginning_default_clock_snapshot; } bt_bool bt_stream_class_packets_have_end_default_clock_snapshot( const struct bt_stream_class *stream_class) { - BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class"); + BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class); return (bt_bool) stream_class->packets_have_end_default_clock_snapshot; } @@ -601,7 +596,7 @@ void bt_stream_class_set_assigns_automatic_stream_id( struct bt_stream_class *stream_class, bt_bool value) { - BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class"); + BT_ASSERT_PRE_SC_NON_NULL(stream_class); BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class); stream_class->assigns_automatic_stream_id = (bool) value; BT_LIB_LOGD("Set stream class's automatic stream ID " @@ -611,7 +606,7 @@ void bt_stream_class_set_assigns_automatic_stream_id( const struct bt_value *bt_stream_class_borrow_user_attributes_const( const struct bt_stream_class *stream_class) { - BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class"); + BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class); return stream_class->user_attributes; } @@ -626,10 +621,9 @@ void bt_stream_class_set_user_attributes( struct bt_stream_class *stream_class, const struct bt_value *user_attributes) { - BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class"); - BT_ASSERT_PRE_NON_NULL(user_attributes, "User attributes"); - BT_ASSERT_PRE(user_attributes->type == BT_VALUE_TYPE_MAP, - "User attributes object is not a map value object."); + BT_ASSERT_PRE_SC_NON_NULL(stream_class); + BT_ASSERT_PRE_USER_ATTRS_NON_NULL(user_attributes); + BT_ASSERT_PRE_USER_ATTRS_IS_MAP(user_attributes); BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class); bt_object_put_ref_no_null_check(stream_class->user_attributes); stream_class->user_attributes = (void *) user_attributes; diff --git a/src/lib/trace-ir/stream.c b/src/lib/trace-ir/stream.c index 07bdcc89..fe36b892 100644 --- a/src/lib/trace-ir/stream.c +++ b/src/lib/trace-ir/stream.c @@ -27,7 +27,7 @@ #include "lib/value.h" #include "lib/func-status.h" -#define BT_ASSERT_PRE_DEV_STREAM_HOT(_stream) \ +#define BT_ASSERT_PRE_DEV_STREAM_HOT(_stream) \ BT_ASSERT_PRE_DEV_HOT((_stream), "Stream", ": %!+s", (_stream)) static @@ -151,8 +151,8 @@ struct bt_stream *bt_stream_create(struct bt_stream_class *stream_class, uint64_t id; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class"); - BT_ASSERT_PRE_NON_NULL(trace, "Trace"); + BT_ASSERT_PRE_SC_NON_NULL(stream_class); + BT_ASSERT_PRE_TRACE_NON_NULL(trace); BT_ASSERT_PRE(stream_class->assigns_automatic_stream_id, "Stream class does not automatically assigns stream IDs: " "%![sc-]+S", stream_class); @@ -164,8 +164,8 @@ struct bt_stream *bt_stream_create_with_id(struct bt_stream_class *stream_class, struct bt_trace *trace, uint64_t id) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class"); - BT_ASSERT_PRE_NON_NULL(trace, "Trace"); + BT_ASSERT_PRE_SC_NON_NULL(stream_class); + BT_ASSERT_PRE_TRACE_NON_NULL(trace); BT_ASSERT_PRE(!stream_class->assigns_automatic_stream_id, "Stream class automatically assigns stream IDs: " "%![sc-]+S", stream_class); @@ -174,7 +174,7 @@ struct bt_stream *bt_stream_create_with_id(struct bt_stream_class *stream_class, struct bt_stream_class *bt_stream_borrow_class(struct bt_stream *stream) { - BT_ASSERT_PRE_DEV_NON_NULL(stream, "Stream"); + BT_ASSERT_PRE_DEV_STREAM_NON_NULL(stream); return stream->class; } @@ -186,7 +186,7 @@ const struct bt_stream_class *bt_stream_borrow_class_const( struct bt_trace *bt_stream_borrow_trace(struct bt_stream *stream) { - BT_ASSERT_PRE_DEV_NON_NULL(stream, "Stream"); + BT_ASSERT_PRE_DEV_STREAM_NON_NULL(stream); return bt_stream_borrow_trace_inline(stream); } @@ -198,7 +198,7 @@ const struct bt_trace *bt_stream_borrow_trace_const( const char *bt_stream_get_name(const struct bt_stream *stream) { - BT_ASSERT_PRE_DEV_NON_NULL(stream, "Stream"); + BT_ASSERT_PRE_DEV_STREAM_NON_NULL(stream); return stream->name.value; } @@ -206,8 +206,8 @@ enum bt_stream_set_name_status bt_stream_set_name(struct bt_stream *stream, const char *name) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(stream, "Stream"); - BT_ASSERT_PRE_NON_NULL(name, "Name"); + BT_ASSERT_PRE_STREAM_NON_NULL(stream); + BT_ASSERT_PRE_NAME_NON_NULL(name); BT_ASSERT_PRE_DEV_STREAM_HOT(stream); g_string_assign(stream->name.str, name); stream->name.value = stream->name.str->str; @@ -217,7 +217,7 @@ enum bt_stream_set_name_status bt_stream_set_name(struct bt_stream *stream, uint64_t bt_stream_get_id(const struct bt_stream *stream) { - BT_ASSERT_PRE_DEV_NON_NULL(stream, "Stream class"); + BT_ASSERT_PRE_DEV_SC_NON_NULL(stream); return stream->id; } @@ -235,7 +235,7 @@ void _bt_stream_freeze(const struct bt_stream *stream) const struct bt_value *bt_stream_borrow_user_attributes_const( const struct bt_stream *stream) { - BT_ASSERT_PRE_DEV_NON_NULL(stream, "Stream"); + BT_ASSERT_PRE_DEV_STREAM_NON_NULL(stream); return stream->user_attributes; } @@ -247,10 +247,9 @@ struct bt_value *bt_stream_borrow_user_attributes(struct bt_stream *stream) void bt_stream_set_user_attributes(struct bt_stream *stream, const struct bt_value *user_attributes) { - BT_ASSERT_PRE_NON_NULL(stream, "Stream"); - BT_ASSERT_PRE_NON_NULL(user_attributes, "User attributes"); - BT_ASSERT_PRE(user_attributes->type == BT_VALUE_TYPE_MAP, - "User attributes object is not a map value object."); + BT_ASSERT_PRE_STREAM_NON_NULL(stream); + BT_ASSERT_PRE_USER_ATTRS_NON_NULL(user_attributes); + BT_ASSERT_PRE_USER_ATTRS_IS_MAP(user_attributes); BT_ASSERT_PRE_DEV_STREAM_HOT(stream); bt_object_put_ref_no_null_check(stream->user_attributes); stream->user_attributes = (void *) user_attributes; diff --git a/src/lib/trace-ir/trace-class.c b/src/lib/trace-ir/trace-class.c index 025698d2..ac66803b 100644 --- a/src/lib/trace-ir/trace-class.c +++ b/src/lib/trace-ir/trace-class.c @@ -118,7 +118,7 @@ struct bt_trace_class *bt_trace_class_create(bt_self_component *self_comp) struct bt_trace_class *tc = NULL; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(self_comp, "Self component"); + BT_ASSERT_PRE_COMP_NON_NULL(self_comp); BT_LOGD_STR("Creating default trace class object."); tc = g_new0(struct bt_trace_class, 1); if (!tc) { @@ -172,8 +172,8 @@ enum bt_trace_class_add_listener_status bt_trace_class_add_destruction_listener( }; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(tc, "Trace class"); - BT_ASSERT_PRE_NON_NULL(listener, "Listener"); + BT_ASSERT_PRE_TC_NON_NULL(tc); + BT_ASSERT_PRE_LISTENER_FUNC_NON_NULL(listener); /* Find the next available spot */ for (i = 0; i < tc->destruction_listeners->len; i++) { @@ -217,7 +217,7 @@ enum bt_trace_class_remove_listener_status bt_trace_class_remove_destruction_lis struct bt_trace_class_destruction_listener_elem *elem; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(tc, "Trace class"); + BT_ASSERT_PRE_TC_NON_NULL(tc); BT_ASSERT_PRE(has_listener_id(tc, listener_id), "Trace class has no such trace class destruction listener ID: " "%![tc-]+T, %" PRIu64, tc, listener_id); @@ -236,14 +236,14 @@ enum bt_trace_class_remove_listener_status bt_trace_class_remove_destruction_lis uint64_t bt_trace_class_get_stream_class_count(const struct bt_trace_class *tc) { - BT_ASSERT_PRE_DEV_NON_NULL(tc, "Trace class"); + BT_ASSERT_PRE_DEV_TC_NON_NULL(tc); return (uint64_t) tc->stream_classes->len; } struct bt_stream_class *bt_trace_class_borrow_stream_class_by_index( struct bt_trace_class *tc, uint64_t index) { - BT_ASSERT_PRE_DEV_NON_NULL(tc, "Trace class"); + BT_ASSERT_PRE_DEV_TC_NON_NULL(tc); BT_ASSERT_PRE_DEV_VALID_INDEX(index, tc->stream_classes->len); return g_ptr_array_index(tc->stream_classes, index); } @@ -262,7 +262,7 @@ struct bt_stream_class *bt_trace_class_borrow_stream_class_by_id( struct bt_stream_class *stream_class = NULL; uint64_t i; - BT_ASSERT_PRE_DEV_NON_NULL(tc, "Trace class"); + BT_ASSERT_PRE_DEV_TC_NON_NULL(tc); for (i = 0; i < tc->stream_classes->len; i++) { struct bt_stream_class *stream_class_candidate = @@ -295,14 +295,14 @@ void _bt_trace_class_freeze(const struct bt_trace_class *tc) bt_bool bt_trace_class_assigns_automatic_stream_class_id(const struct bt_trace_class *tc) { - BT_ASSERT_PRE_DEV_NON_NULL(tc, "Trace class"); + BT_ASSERT_PRE_DEV_TC_NON_NULL(tc); return (bt_bool) tc->assigns_automatic_stream_class_id; } void bt_trace_class_set_assigns_automatic_stream_class_id(struct bt_trace_class *tc, bt_bool value) { - BT_ASSERT_PRE_NON_NULL(tc, "Trace class"); + BT_ASSERT_PRE_TC_NON_NULL(tc); BT_ASSERT_PRE_DEV_TRACE_CLASS_HOT(tc); tc->assigns_automatic_stream_class_id = (bool) value; BT_LIB_LOGD("Set trace class's automatic stream class ID " @@ -312,7 +312,7 @@ void bt_trace_class_set_assigns_automatic_stream_class_id(struct bt_trace_class const struct bt_value *bt_trace_class_borrow_user_attributes_const( const struct bt_trace_class *trace_class) { - BT_ASSERT_PRE_DEV_NON_NULL(trace_class, "Trace class"); + BT_ASSERT_PRE_DEV_TC_NON_NULL(trace_class); return trace_class->user_attributes; } @@ -326,10 +326,9 @@ struct bt_value *bt_trace_class_borrow_user_attributes( void bt_trace_class_set_user_attributes(struct bt_trace_class *trace_class, const struct bt_value *user_attributes) { - BT_ASSERT_PRE_NON_NULL(trace_class, "Trace class"); - BT_ASSERT_PRE_NON_NULL(user_attributes, "User attributes"); - BT_ASSERT_PRE(user_attributes->type == BT_VALUE_TYPE_MAP, - "User attributes object is not a map value object."); + BT_ASSERT_PRE_TC_NON_NULL(trace_class); + BT_ASSERT_PRE_USER_ATTRS_NON_NULL(user_attributes); + BT_ASSERT_PRE_USER_ATTRS_IS_MAP(user_attributes); BT_ASSERT_PRE_DEV_TRACE_CLASS_HOT(trace_class); bt_object_put_ref_no_null_check(trace_class->user_attributes); trace_class->user_attributes = (void *) user_attributes; diff --git a/src/lib/trace-ir/trace.c b/src/lib/trace-ir/trace.c index 1be8992b..897812e7 100644 --- a/src/lib/trace-ir/trace.c +++ b/src/lib/trace-ir/trace.c @@ -203,7 +203,7 @@ end: const char *bt_trace_get_name(const struct bt_trace *trace) { - BT_ASSERT_PRE_DEV_NON_NULL(trace, "Trace"); + BT_ASSERT_PRE_DEV_TRACE_NON_NULL(trace); return trace->name.value; } @@ -211,8 +211,8 @@ enum bt_trace_set_name_status bt_trace_set_name(struct bt_trace *trace, const char *name) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(trace, "Trace"); - BT_ASSERT_PRE_NON_NULL(name, "Name"); + BT_ASSERT_PRE_TRACE_NON_NULL(trace); + BT_ASSERT_PRE_NAME_NON_NULL(name); BT_ASSERT_PRE_DEV_TRACE_HOT(trace); g_string_assign(trace->name.str, name); trace->name.value = trace->name.str->str; @@ -222,14 +222,14 @@ enum bt_trace_set_name_status bt_trace_set_name(struct bt_trace *trace, bt_uuid bt_trace_get_uuid(const struct bt_trace *trace) { - BT_ASSERT_PRE_DEV_NON_NULL(trace, "Trace"); + BT_ASSERT_PRE_DEV_TRACE_NON_NULL(trace); return trace->uuid.value; } void bt_trace_set_uuid(struct bt_trace *trace, bt_uuid uuid) { - BT_ASSERT_PRE_NON_NULL(trace, "Trace"); - BT_ASSERT_PRE_NON_NULL(uuid, "UUID"); + BT_ASSERT_PRE_TRACE_NON_NULL(trace); + BT_ASSERT_PRE_UUID_NON_NULL(uuid); BT_ASSERT_PRE_DEV_TRACE_HOT(trace); bt_uuid_copy(trace->uuid.uuid, uuid); trace->uuid.value = trace->uuid.uuid; @@ -283,8 +283,8 @@ bt_trace_set_environment_entry_string( struct bt_value *value_obj; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(trace, "Trace"); - BT_ASSERT_PRE_NON_NULL(name, "Name"); + BT_ASSERT_PRE_TRACE_NON_NULL(trace); + BT_ASSERT_PRE_NAME_NON_NULL(name); BT_ASSERT_PRE_NON_NULL(value, "Value"); value_obj = bt_value_string_create_init(value); @@ -311,8 +311,8 @@ bt_trace_set_environment_entry_integer( struct bt_value *value_obj; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(trace, "Trace"); - BT_ASSERT_PRE_NON_NULL(name, "Name"); + BT_ASSERT_PRE_TRACE_NON_NULL(trace); + BT_ASSERT_PRE_NAME_NON_NULL(name); value_obj = bt_value_integer_signed_create_init(value); if (!value_obj) { @@ -332,7 +332,7 @@ end: uint64_t bt_trace_get_environment_entry_count(const struct bt_trace *trace) { - BT_ASSERT_PRE_DEV_NON_NULL(trace, "Trace"); + BT_ASSERT_PRE_DEV_TRACE_NON_NULL(trace); return bt_attributes_get_count(trace->environment); } @@ -340,8 +340,8 @@ void bt_trace_borrow_environment_entry_by_index_const( const struct bt_trace *trace, uint64_t index, const char **name, const struct bt_value **value) { - BT_ASSERT_PRE_DEV_NON_NULL(trace, "Trace"); - BT_ASSERT_PRE_DEV_NON_NULL(name, "Name"); + BT_ASSERT_PRE_DEV_TRACE_NON_NULL(trace); + BT_ASSERT_PRE_DEV_NAME_NON_NULL(name); BT_ASSERT_PRE_DEV_NON_NULL(value, "Value"); BT_ASSERT_PRE_DEV_VALID_INDEX(index, bt_attributes_get_count(trace->environment)); @@ -354,22 +354,22 @@ void bt_trace_borrow_environment_entry_by_index_const( const struct bt_value *bt_trace_borrow_environment_entry_value_by_name_const( const struct bt_trace *trace, const char *name) { - BT_ASSERT_PRE_DEV_NON_NULL(trace, "Trace"); - BT_ASSERT_PRE_DEV_NON_NULL(name, "Name"); + BT_ASSERT_PRE_DEV_TRACE_NON_NULL(trace); + BT_ASSERT_PRE_DEV_NAME_NON_NULL(name); return bt_attributes_borrow_field_value_by_name(trace->environment, name); } uint64_t bt_trace_get_stream_count(const struct bt_trace *trace) { - BT_ASSERT_PRE_DEV_NON_NULL(trace, "Trace"); + BT_ASSERT_PRE_DEV_TRACE_NON_NULL(trace); return (uint64_t) trace->streams->len; } struct bt_stream *bt_trace_borrow_stream_by_index( struct bt_trace *trace, uint64_t index) { - BT_ASSERT_PRE_DEV_NON_NULL(trace, "Trace"); + BT_ASSERT_PRE_DEV_TRACE_NON_NULL(trace); BT_ASSERT_PRE_DEV_VALID_INDEX(index, trace->streams->len); return g_ptr_array_index(trace->streams, index); } @@ -386,7 +386,7 @@ struct bt_stream *bt_trace_borrow_stream_by_id(struct bt_trace *trace, struct bt_stream *stream = NULL; uint64_t i; - BT_ASSERT_PRE_DEV_NON_NULL(trace, "Trace"); + BT_ASSERT_PRE_DEV_TRACE_NON_NULL(trace); for (i = 0; i < trace->streams->len; i++) { struct bt_stream *stream_candidate = @@ -421,8 +421,8 @@ enum bt_trace_add_listener_status bt_trace_add_destruction_listener( }; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(trace, "Trace"); - BT_ASSERT_PRE_NON_NULL(listener, "Listener"); + BT_ASSERT_PRE_TRACE_NON_NULL(trace); + BT_ASSERT_PRE_LISTENER_FUNC_NON_NULL(listener); /* Find the next available spot */ for (i = 0; i < trace->destruction_listeners->len; i++) { @@ -466,7 +466,7 @@ enum bt_trace_remove_listener_status bt_trace_remove_destruction_listener( struct bt_trace_destruction_listener_elem *elem; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(trace, "Trace"); + BT_ASSERT_PRE_TRACE_NON_NULL(trace); BT_ASSERT_PRE(has_listener_id(trace, listener_id), "Trace has no such trace destruction listener ID: " "%![trace-]+t, %" PRIu64, trace, listener_id); @@ -535,7 +535,7 @@ uint64_t bt_trace_get_automatic_stream_id(const struct bt_trace *trace, struct bt_trace_class *bt_trace_borrow_class(struct bt_trace *trace) { - BT_ASSERT_PRE_DEV_NON_NULL(trace, "Trace"); + BT_ASSERT_PRE_DEV_TRACE_NON_NULL(trace); return trace->class; } @@ -548,7 +548,7 @@ const struct bt_trace_class *bt_trace_borrow_class_const( const struct bt_value *bt_trace_borrow_user_attributes_const( const struct bt_trace *trace) { - BT_ASSERT_PRE_DEV_NON_NULL(trace, "Trace"); + BT_ASSERT_PRE_DEV_TRACE_NON_NULL(trace); return trace->user_attributes; } @@ -561,10 +561,9 @@ void bt_trace_set_user_attributes( struct bt_trace *trace, const struct bt_value *user_attributes) { - BT_ASSERT_PRE_NON_NULL(trace, "Trace"); - BT_ASSERT_PRE_NON_NULL(user_attributes, "User attributes"); - BT_ASSERT_PRE(user_attributes->type == BT_VALUE_TYPE_MAP, - "User attributes object is not a map value object."); + BT_ASSERT_PRE_TRACE_NON_NULL(trace); + BT_ASSERT_PRE_USER_ATTRS_NON_NULL(user_attributes); + BT_ASSERT_PRE_USER_ATTRS_IS_MAP(user_attributes); BT_ASSERT_PRE_DEV_TRACE_HOT(trace); bt_object_put_ref_no_null_check(trace->user_attributes); trace->user_attributes = (void *) user_attributes; diff --git a/src/lib/value.c b/src/lib/value.c index 5ddf4e6f..701143fd 100644 --- a/src/lib/value.c +++ b/src/lib/value.c @@ -21,9 +21,9 @@ #include "common/assert.h" #include "func-status.h" -#define BT_ASSERT_PRE_DEV_VALUE_HOT(_value, _name) \ - BT_ASSERT_PRE_DEV_HOT(((struct bt_value *) (_value)), (_name), \ - ": %!+v", (_value)) +#define BT_ASSERT_PRE_DEV_VALUE_HOT(_value) \ + BT_ASSERT_PRE_DEV_HOT(((struct bt_value *) (_value)), \ + "Value object", ": %!+v", (_value)) #define BT_VALUE_TO_BOOL(_base) ((struct bt_value_bool *) (_base)) #define BT_VALUE_TO_INTEGER(_base) ((struct bt_value_integer *) (_base)) @@ -537,7 +537,7 @@ end: enum bt_value_type bt_value_get_type(const struct bt_value *object) { - BT_ASSERT_PRE_DEV_NON_NULL(object, "Value object"); + BT_ASSERT_PRE_DEV_VALUE_NON_NULL(object); return object->type; } @@ -680,7 +680,7 @@ struct bt_value *bt_value_string_create_init(const char *val) struct bt_value_string *string_obj = NULL; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(val, "Value"); + BT_ASSERT_PRE_NON_NULL(val, "Raw value"); BT_LOGD("Creating string value object: val-len=%zu", strlen(val)); string_obj = g_new0(struct bt_value_string, 1); @@ -777,16 +777,16 @@ end: bt_bool bt_value_bool_get(const struct bt_value *bool_obj) { - BT_ASSERT_PRE_DEV_NON_NULL(bool_obj, "Value object"); + BT_ASSERT_PRE_DEV_VALUE_NON_NULL(bool_obj); BT_ASSERT_PRE_DEV_VALUE_HAS_TYPE(bool_obj, BT_VALUE_TYPE_BOOL); return BT_VALUE_TO_BOOL(bool_obj)->value; } void bt_value_bool_set(struct bt_value *bool_obj, bt_bool val) { - BT_ASSERT_PRE_NON_NULL(bool_obj, "Value object"); + BT_ASSERT_PRE_VALUE_NON_NULL(bool_obj); BT_ASSERT_PRE_VALUE_HAS_TYPE(bool_obj, BT_VALUE_TYPE_BOOL); - BT_ASSERT_PRE_DEV_VALUE_HOT(bool_obj, "Value object"); + BT_ASSERT_PRE_DEV_VALUE_HOT(bool_obj); BT_VALUE_TO_BOOL(bool_obj)->value = val; BT_LOGT("Set boolean value's raw value: value-addr=%p, value=%d", bool_obj, val); @@ -794,7 +794,7 @@ void bt_value_bool_set(struct bt_value *bool_obj, bt_bool val) uint64_t bt_value_integer_unsigned_get(const struct bt_value *integer_obj) { - BT_ASSERT_PRE_DEV_NON_NULL(integer_obj, "Value object"); + BT_ASSERT_PRE_DEV_VALUE_NON_NULL(integer_obj); BT_ASSERT_PRE_DEV_VALUE_HAS_TYPE(integer_obj, BT_VALUE_TYPE_UNSIGNED_INTEGER); return BT_VALUE_TO_INTEGER(integer_obj)->value.u; @@ -802,7 +802,7 @@ uint64_t bt_value_integer_unsigned_get(const struct bt_value *integer_obj) int64_t bt_value_integer_signed_get(const struct bt_value *integer_obj) { - BT_ASSERT_PRE_DEV_NON_NULL(integer_obj, "Value object"); + BT_ASSERT_PRE_DEV_VALUE_NON_NULL(integer_obj); BT_ASSERT_PRE_DEV_VALUE_HAS_TYPE(integer_obj, BT_VALUE_TYPE_SIGNED_INTEGER); return BT_VALUE_TO_INTEGER(integer_obj)->value.i; @@ -812,9 +812,9 @@ static inline void bt_value_integer_set(struct bt_value *integer_obj, enum bt_value_type expected_type, uint64_t uval) { - BT_ASSERT_PRE_NON_NULL(integer_obj, "Value object"); + BT_ASSERT_PRE_VALUE_NON_NULL(integer_obj); BT_ASSERT_PRE_VALUE_HAS_TYPE(integer_obj, expected_type); - BT_ASSERT_PRE_DEV_VALUE_HOT(integer_obj, "Value object"); + BT_ASSERT_PRE_DEV_VALUE_HOT(integer_obj); BT_VALUE_TO_INTEGER(integer_obj)->value.u = uval; } @@ -837,16 +837,16 @@ void bt_value_integer_signed_set(struct bt_value *integer_obj, double bt_value_real_get(const struct bt_value *real_obj) { - BT_ASSERT_PRE_DEV_NON_NULL(real_obj, "Value object"); + BT_ASSERT_PRE_DEV_VALUE_NON_NULL(real_obj); BT_ASSERT_PRE_DEV_VALUE_HAS_TYPE(real_obj, BT_VALUE_TYPE_REAL); return BT_VALUE_TO_REAL(real_obj)->value; } void bt_value_real_set(struct bt_value *real_obj, double val) { - BT_ASSERT_PRE_NON_NULL(real_obj, "Value object"); + BT_ASSERT_PRE_VALUE_NON_NULL(real_obj); BT_ASSERT_PRE_VALUE_HAS_TYPE(real_obj, BT_VALUE_TYPE_REAL); - BT_ASSERT_PRE_DEV_VALUE_HOT(real_obj, "Value object"); + BT_ASSERT_PRE_DEV_VALUE_HOT(real_obj); BT_VALUE_TO_REAL(real_obj)->value = val; BT_LOGT("Set real number value's raw value: value-addr=%p, value=%f", real_obj, val); @@ -854,7 +854,7 @@ void bt_value_real_set(struct bt_value *real_obj, double val) const char *bt_value_string_get(const struct bt_value *string_obj) { - BT_ASSERT_PRE_DEV_NON_NULL(string_obj, "Value object"); + BT_ASSERT_PRE_DEV_VALUE_NON_NULL(string_obj); BT_ASSERT_PRE_DEV_VALUE_HAS_TYPE(string_obj, BT_VALUE_TYPE_STRING); return BT_VALUE_TO_STRING(string_obj)->gstr->str; } @@ -863,9 +863,9 @@ enum bt_value_string_set_status bt_value_string_set( struct bt_value *string_obj, const char *val) { BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(string_obj, "Value object"); + BT_ASSERT_PRE_VALUE_NON_NULL(string_obj); BT_ASSERT_PRE_VALUE_HAS_TYPE(string_obj, BT_VALUE_TYPE_STRING); - BT_ASSERT_PRE_DEV_VALUE_HOT(string_obj, "Value object"); + BT_ASSERT_PRE_DEV_VALUE_HOT(string_obj); g_string_assign(BT_VALUE_TO_STRING(string_obj)->gstr, val); BT_LOGT("Set string value's raw value: value-addr=%p, raw-value-addr=%p", string_obj, val); @@ -874,7 +874,7 @@ enum bt_value_string_set_status bt_value_string_set( uint64_t bt_value_array_get_length(const struct bt_value *array_obj) { - BT_ASSERT_PRE_DEV_NON_NULL(array_obj, "Value object"); + BT_ASSERT_PRE_DEV_VALUE_NON_NULL(array_obj); BT_ASSERT_PRE_DEV_VALUE_HAS_TYPE(array_obj, BT_VALUE_TYPE_ARRAY); return (uint64_t) BT_VALUE_TO_ARRAY(array_obj)->garray->len; } @@ -885,7 +885,7 @@ struct bt_value *bt_value_array_borrow_element_by_index( struct bt_value_array *typed_array_obj = BT_VALUE_TO_ARRAY(array_obj); - BT_ASSERT_PRE_DEV_NON_NULL(array_obj, "Value object"); + BT_ASSERT_PRE_DEV_VALUE_NON_NULL(array_obj); BT_ASSERT_PRE_DEV_VALUE_HAS_TYPE(array_obj, BT_VALUE_TYPE_ARRAY); BT_ASSERT_PRE_DEV_VALID_INDEX(index, typed_array_obj->garray->len); return g_ptr_array_index(typed_array_obj->garray, index); @@ -910,7 +910,7 @@ enum bt_value_array_append_element_status bt_value_array_append_element( BT_ASSERT_PRE_NON_NULL(array_obj, "Array value object"); BT_ASSERT_PRE_NON_NULL(element_obj, "Element value object"); BT_ASSERT_PRE_VALUE_HAS_TYPE(array_obj, BT_VALUE_TYPE_ARRAY); - BT_ASSERT_PRE_DEV_VALUE_HOT(array_obj, "Array value object"); + BT_ASSERT_PRE_DEV_VALUE_HOT(array_obj); g_ptr_array_add(typed_array_obj->garray, element_obj); bt_object_get_ref(element_obj); BT_LOGT("Appended element to array value: array-value-addr=%p, " @@ -1050,7 +1050,7 @@ bt_value_array_set_element_by_index(struct bt_value *array_obj, uint64_t index, BT_ASSERT_PRE_NON_NULL(array_obj, "Array value object"); BT_ASSERT_PRE_NON_NULL(element_obj, "Element value object"); BT_ASSERT_PRE_VALUE_HAS_TYPE(array_obj, BT_VALUE_TYPE_ARRAY); - BT_ASSERT_PRE_DEV_VALUE_HOT(array_obj, "Array value object"); + BT_ASSERT_PRE_DEV_VALUE_HOT(array_obj); BT_ASSERT_PRE_VALID_INDEX(index, typed_array_obj->garray->len); bt_object_put_ref(g_ptr_array_index(typed_array_obj->garray, index)); g_ptr_array_index(typed_array_obj->garray, index) = element_obj; @@ -1063,7 +1063,7 @@ bt_value_array_set_element_by_index(struct bt_value *array_obj, uint64_t index, uint64_t bt_value_map_get_size(const struct bt_value *map_obj) { - BT_ASSERT_PRE_DEV_NON_NULL(map_obj, "Value object"); + BT_ASSERT_PRE_DEV_VALUE_NON_NULL(map_obj); BT_ASSERT_PRE_DEV_VALUE_HAS_TYPE(map_obj, BT_VALUE_TYPE_MAP); return (uint64_t) g_hash_table_size(BT_VALUE_TO_MAP(map_obj)->ght); } @@ -1071,8 +1071,8 @@ uint64_t bt_value_map_get_size(const struct bt_value *map_obj) struct bt_value *bt_value_map_borrow_entry_value(struct bt_value *map_obj, const char *key) { - BT_ASSERT_PRE_DEV_NON_NULL(map_obj, "Value object"); - BT_ASSERT_PRE_DEV_NON_NULL(key, "Key"); + BT_ASSERT_PRE_DEV_VALUE_NON_NULL(map_obj); + BT_ASSERT_PRE_DEV_KEY_NON_NULL(key); BT_ASSERT_PRE_DEV_VALUE_HAS_TYPE(map_obj, BT_VALUE_TYPE_MAP); return g_hash_table_lookup(BT_VALUE_TO_MAP(map_obj)->ght, GUINT_TO_POINTER(g_quark_from_string(key))); @@ -1086,8 +1086,8 @@ const struct bt_value *bt_value_map_borrow_entry_value_const( bt_bool bt_value_map_has_entry(const struct bt_value *map_obj, const char *key) { - BT_ASSERT_PRE_DEV_NON_NULL(map_obj, "Value object"); - BT_ASSERT_PRE_DEV_NON_NULL(key, "Key"); + BT_ASSERT_PRE_DEV_VALUE_NON_NULL(map_obj); + BT_ASSERT_PRE_DEV_KEY_NON_NULL(key); BT_ASSERT_PRE_DEV_VALUE_HAS_TYPE(map_obj, BT_VALUE_TYPE_MAP); return bt_g_hash_table_contains(BT_VALUE_TO_MAP(map_obj)->ght, GUINT_TO_POINTER(g_quark_from_string(key))); @@ -1099,10 +1099,10 @@ enum bt_value_map_insert_entry_status bt_value_map_insert_entry( { BT_ASSERT_PRE_NO_ERROR(); BT_ASSERT_PRE_NON_NULL(map_obj, "Map value object"); - BT_ASSERT_PRE_NON_NULL(key, "Key"); + BT_ASSERT_PRE_KEY_NON_NULL(key); BT_ASSERT_PRE_NON_NULL(element_obj, "Element value object"); BT_ASSERT_PRE_VALUE_HAS_TYPE(map_obj, BT_VALUE_TYPE_MAP); - BT_ASSERT_PRE_DEV_VALUE_HOT(map_obj, "Map value object"); + BT_ASSERT_PRE_DEV_VALUE_HOT(map_obj); g_hash_table_insert(BT_VALUE_TO_MAP(map_obj)->ght, GUINT_TO_POINTER(g_quark_from_string(key)), element_obj); bt_object_get_ref(element_obj); @@ -1244,8 +1244,8 @@ enum bt_value_map_foreach_entry_status bt_value_map_foreach_entry( BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_DEV_NON_NULL(map_obj, "Value object"); - BT_ASSERT_PRE_DEV_NON_NULL(func, "Callback"); + BT_ASSERT_PRE_DEV_VALUE_NON_NULL(map_obj); + BT_ASSERT_PRE_DEV_NON_NULL(func, "User function"); BT_ASSERT_PRE_DEV_VALUE_HAS_TYPE(map_obj, BT_VALUE_TYPE_MAP); g_hash_table_iter_init(&iter, typed_map_obj->ght); @@ -1355,7 +1355,7 @@ enum bt_value_map_extend_status bt_value_map_extend( BT_ASSERT_PRE_NO_ERROR(); BT_ASSERT_PRE_NON_NULL(base_map_obj, "Base value object"); - BT_ASSERT_PRE_DEV_VALUE_HOT(base_map_obj, "Base value object"); + BT_ASSERT_PRE_DEV_VALUE_HOT(base_map_obj); BT_ASSERT_PRE_NON_NULL(extension_obj, "Extension value object"); BT_ASSERT_PRE_VALUE_HAS_TYPE(base_map_obj, BT_VALUE_TYPE_MAP); BT_ASSERT_PRE_VALUE_HAS_TYPE(extension_obj, BT_VALUE_TYPE_MAP); @@ -1385,7 +1385,7 @@ enum bt_value_copy_status bt_value_copy(const struct bt_value *object, enum bt_value_copy_status status = BT_FUNC_STATUS_OK; BT_ASSERT_PRE_NO_ERROR(); - BT_ASSERT_PRE_NON_NULL(object, "Value object"); + BT_ASSERT_PRE_VALUE_NON_NULL(object); BT_ASSERT_PRE_NON_NULL(copy_obj, "Value object copy (output)"); BT_LOGD("Copying value object: addr=%p", object); *copy_obj = copy_funcs[object->type](object); -- 2.34.1