* SOFTWARE.
*/
-#define BT_LOG_TAG "FIELD-CLASSES"
-#include "lib/lib-logging.h"
+#define BT_LOG_TAG "LIB/FIELD-CLASS"
+#include "lib/logging.h"
#include "lib/assert-pre.h"
#include <babeltrace2/trace-ir/field-class.h>
#include "field.h"
#include "field-path.h"
#include "utils.h"
+#include "lib/func-status.h"
enum bt_field_class_type bt_field_class_get_type(
const struct bt_field_class *fc)
{
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
return fc->type;
}
bt_common_field_class_type_string(type));
int_fc = g_new0(struct bt_field_class_integer, 1);
if (!int_fc) {
- BT_LOGE_STR("Failed to allocate one integer field class.");
+ BT_LIB_LOGE_APPEND_CAUSE(
+ "Failed to allocate one integer field class.");
goto error;
}
{
const struct bt_field_class_integer *int_fc = (const void *) fc;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_IS_INT(fc, "Field class");
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_IS_INT(fc, "Field class");
return int_fc->range;
}
BT_ASSERT_PRE_NON_NULL(fc, "Field class");
BT_ASSERT_PRE_FC_IS_INT(fc, "Field class");
- BT_ASSERT_PRE_FC_HOT(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HOT(fc, "Field class");
BT_ASSERT_PRE(size <= 64,
"Unsupported size for integer field class's field value range "
"(maximum is 64): size=%" PRIu64, size);
{
const struct bt_field_class_integer *int_fc = (const void *) fc;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_IS_INT(fc, "Field class");
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_IS_INT(fc, "Field class");
return int_fc->base;
}
BT_ASSERT_PRE_NON_NULL(fc, "Field class");
BT_ASSERT_PRE_FC_IS_INT(fc, "Field class");
- BT_ASSERT_PRE_FC_HOT(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HOT(fc, "Field class");
int_fc->base = base;
BT_LIB_LOGD("Set integer field class's preferred display base: %!+F", fc);
}
bt_common_field_class_type_string(type));
enum_fc = g_new0(struct bt_field_class_enumeration, 1);
if (!enum_fc) {
- BT_LOGE_STR("Failed to allocate one enumeration field class.");
+ BT_LIB_LOGE_APPEND_CAUSE(
+ "Failed to allocate one enumeration field class.");
goto error;
}
enum_fc->mappings = g_array_new(FALSE, TRUE,
sizeof(struct bt_field_class_enumeration_mapping));
if (!enum_fc->mappings) {
- BT_LOGE_STR("Failed to allocate a GArray.");
+ BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate a GArray.");
goto error;
}
enum_fc->label_buf = g_ptr_array_new();
if (!enum_fc->label_buf) {
- BT_LOGE_STR("Failed to allocate a GArray.");
+ BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate a GArray.");
goto error;
}
{
const struct bt_field_class_enumeration *enum_fc = (const void *) fc;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_IS_ENUM(fc, "Field class");
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_IS_ENUM(fc, "Field class");
return (uint64_t) enum_fc->mappings->len;
}
{
const struct bt_field_class_enumeration *enum_fc = (const void *) fc;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_VALID_INDEX(index, enum_fc->mappings->len);
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION,
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_VALID_INDEX(index, enum_fc->mappings->len);
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION,
"Field class");
return (const void *) BT_FIELD_CLASS_ENUM_MAPPING_AT_INDEX(fc, index);
}
{
const struct bt_field_class_enumeration *enum_fc = (const void *) fc;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_VALID_INDEX(index, enum_fc->mappings->len);
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION,
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_VALID_INDEX(index, enum_fc->mappings->len);
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION,
"Field class");
return (const void *) BT_FIELD_CLASS_ENUM_MAPPING_AT_INDEX(fc, index);
}
const char *bt_field_class_enumeration_mapping_get_label(
const struct bt_field_class_enumeration_mapping *mapping)
{
- BT_ASSERT_PRE_NON_NULL(mapping, "Enumeration field class mapping");
+ BT_ASSERT_PRE_DEV_NON_NULL(mapping, "Enumeration field class mapping");
return mapping->label->str;
}
uint64_t bt_field_class_enumeration_mapping_get_range_count(
const struct bt_field_class_enumeration_mapping *mapping)
{
- BT_ASSERT_PRE_NON_NULL(mapping, "Enumeration field class mapping");
+ BT_ASSERT_PRE_DEV_NON_NULL(mapping, "Enumeration field class mapping");
return (uint64_t) mapping->ranges->len;
}
{
const struct bt_field_class_enumeration_mapping_range *range;
- BT_ASSERT_PRE_NON_NULL(mapping, "Ranges");
- BT_ASSERT_PRE_NON_NULL(lower, "Range's lower (output)");
- BT_ASSERT_PRE_NON_NULL(upper, "Range's upper (output)");
- BT_ASSERT_PRE_VALID_INDEX(index, mapping->ranges->len);
+ BT_ASSERT_PRE_DEV_NON_NULL(mapping, "Ranges");
+ BT_ASSERT_PRE_DEV_NON_NULL(lower, "Range's lower (output)");
+ BT_ASSERT_PRE_DEV_NON_NULL(upper, "Range's upper (output)");
+ BT_ASSERT_PRE_DEV_VALID_INDEX(index, mapping->ranges->len);
range = BT_FIELD_CLASS_ENUM_MAPPING_RANGE_AT_INDEX(mapping, index);
*lower = range->lower.u;
*upper = range->upper.u;
(uint64_t *) lower, (uint64_t *) upper);
}
-enum bt_field_class_status
-bt_field_class_unsigned_enumeration_get_mapping_labels_by_value(
+enum bt_field_class_enumeration_get_mapping_labels_for_value_status
+bt_field_class_unsigned_enumeration_get_mapping_labels_for_value(
const struct bt_field_class *fc, uint64_t value,
bt_field_class_enumeration_mapping_label_array *label_array,
uint64_t *count)
const struct bt_field_class_enumeration *enum_fc = (const void *) fc;
uint64_t i;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_NON_NULL(label_array, "Label array (output)");
- BT_ASSERT_PRE_NON_NULL(count, "Count (output)");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION,
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ 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_ID(fc, BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION,
"Field class");
g_ptr_array_set_size(enum_fc->label_buf, 0);
*label_array = (void *) enum_fc->label_buf->pdata;
*count = (uint64_t) enum_fc->label_buf->len;
- return BT_FIELD_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_field_class_status
-bt_field_class_signed_enumeration_get_mapping_labels_by_value(
+enum bt_field_class_enumeration_get_mapping_labels_for_value_status
+bt_field_class_signed_enumeration_get_mapping_labels_for_value(
const struct bt_field_class *fc, int64_t value,
bt_field_class_enumeration_mapping_label_array *label_array,
uint64_t *count)
const struct bt_field_class_enumeration *enum_fc = (const void *) fc;
uint64_t i;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_NON_NULL(label_array, "Label array (output)");
- BT_ASSERT_PRE_NON_NULL(count, "Count (output)");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION,
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ 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_ID(fc, BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION,
"Field class");
g_ptr_array_set_size(enum_fc->label_buf, 0);
*label_array = (void *) enum_fc->label_buf->pdata;
*count = (uint64_t) enum_fc->label_buf->len;
- return BT_FIELD_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
static inline
-enum bt_field_class_status add_mapping_to_enumeration_field_class(
+enum bt_field_class_enumeration_map_range_status
+add_mapping_to_enumeration_field_class(
struct bt_field_class *fc,
const char *label, uint64_t lower, uint64_t upper)
{
- int ret = BT_FIELD_CLASS_STATUS_OK;
+ int ret = BT_FUNC_STATUS_OK;
uint64_t i;
struct bt_field_class_enumeration *enum_fc = (void *) fc;
struct bt_field_class_enumeration_mapping *mapping = NULL;
finalize_enumeration_field_class_mapping(mapping);
g_array_set_size(enum_fc->mappings,
enum_fc->mappings->len - 1);
- ret = BT_FIELD_CLASS_STATUS_NOMEM;
+ ret = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
finalize_enumeration_field_class_mapping(mapping);
g_array_set_size(enum_fc->mappings,
enum_fc->mappings->len - 1);
- ret = BT_FIELD_CLASS_STATUS_NOMEM;
+ ret = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
}
return ret;
}
-enum bt_field_class_status bt_field_class_unsigned_enumeration_map_range(
+enum bt_field_class_enumeration_map_range_status
+bt_field_class_unsigned_enumeration_map_range(
struct bt_field_class *fc, const char *label,
uint64_t range_lower, uint64_t range_upper)
{
range_upper);
}
-enum bt_field_class_status bt_field_class_signed_enumeration_map_range(
+enum bt_field_class_enumeration_map_range_status
+bt_field_class_signed_enumeration_map_range(
struct bt_field_class *fc, const char *label,
int64_t range_lower, int64_t range_upper)
{
BT_LOGD_STR("Creating default real field class object.");
real_fc = g_new0(struct bt_field_class_real, 1);
if (!real_fc) {
- BT_LOGE_STR("Failed to allocate one real field class.");
+ BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate one real field class.");
goto error;
}
{
const struct bt_field_class_real *real_fc = (const void *) fc;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_REAL, "Field class");
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_REAL, "Field class");
return real_fc->is_single_precision;
}
BT_ASSERT_PRE_NON_NULL(fc, "Field class");
BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_REAL, "Field class");
- BT_ASSERT_PRE_FC_HOT(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HOT(fc, "Field class");
real_fc->is_single_precision = (bool) is_single_precision;
BT_LIB_LOGD("Set real field class's \"is single precision\" property: "
"%!+F", fc);
fc->named_fcs = g_array_new(FALSE, TRUE,
sizeof(struct bt_named_field_class));
if (!fc->named_fcs) {
- BT_LOGE_STR("Failed to allocate a GArray.");
+ BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate a GArray.");
ret = -1;
goto end;
}
fc->name_to_index = g_hash_table_new(g_str_hash, g_str_equal);
if (!fc->name_to_index) {
- BT_LOGE_STR("Failed to allocate a GHashTable.");
+ BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate a GHashTable.");
ret = -1;
goto end;
}
BT_LOGD_STR("Creating default structure field class object.");
struct_fc = g_new0(struct bt_field_class_structure, 1);
if (!struct_fc) {
- BT_LOGE_STR("Failed to allocate one structure field class.");
+ BT_LIB_LOGE_APPEND_CAUSE(
+ "Failed to allocate one structure field class.");
goto error;
}
}
static
-enum bt_field_class_status append_named_field_class_to_container_field_class(
+int append_named_field_class_to_container_field_class(
struct bt_field_class_named_field_class_container *container_fc,
const char *name, struct bt_field_class *fc)
{
- int ret = BT_FIELD_CLASS_STATUS_OK;
+ int ret = BT_FUNC_STATUS_OK;
struct bt_named_field_class *named_fc;
GString *name_str;
BT_ASSERT(container_fc);
- BT_ASSERT_PRE_FC_HOT(container_fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HOT(container_fc, "Field class");
BT_ASSERT_PRE_NON_NULL(name, "Name");
BT_ASSERT_PRE_NON_NULL(fc, "Field class");
BT_ASSERT_PRE(!bt_g_hash_table_contains(container_fc->name_to_index,
"%![container-fc-]+F, name=\"%s\"", container_fc, name);
name_str = g_string_new(name);
if (!name_str) {
- BT_LOGE_STR("Failed to allocate a GString.");
- ret = BT_FIELD_CLASS_STATUS_NOMEM;
+ BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate a GString.");
+ ret = BT_FUNC_STATUS_MEMORY_ERROR;
goto end;
}
return ret;
}
-enum bt_field_class_status bt_field_class_structure_append_member(
+enum bt_field_class_structure_append_member_status
+bt_field_class_structure_append_member(
struct bt_field_class *fc, const char *name,
struct bt_field_class *member_fc)
{
{
struct bt_field_class_structure *struct_fc = (void *) fc;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_STRUCTURE,
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_STRUCTURE,
"Field class");
return (uint64_t) struct_fc->common.named_fcs->len;
}
uint64_t index)
{
BT_ASSERT(fc);
- BT_ASSERT_PRE_VALID_INDEX(index, fc->named_fcs->len);
+ BT_ASSERT_PRE_DEV_VALID_INDEX(index, fc->named_fcs->len);
return BT_FIELD_CLASS_NAMED_FC_AT_INDEX(fc, index);
}
bt_field_class_structure_borrow_member_by_index_const(
const struct bt_field_class *fc, uint64_t index)
{
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_STRUCTURE,
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_STRUCTURE,
"Field class");
return (const void *)
borrow_named_field_class_from_container_field_class_at_index(
bt_field_class_structure_borrow_member_by_index(
struct bt_field_class *fc, uint64_t index)
{
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_STRUCTURE,
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_STRUCTURE,
"Field class");
return (void *)
borrow_named_field_class_from_container_field_class_at_index(
gpointer value;
BT_ASSERT(fc);
- BT_ASSERT_PRE_NON_NULL(name, "Name");
+ BT_ASSERT_PRE_DEV_NON_NULL(name, "Name");
if (!g_hash_table_lookup_extended(fc->name_to_index, name, &orig_key,
&value)) {
goto end;
bt_field_class_structure_borrow_member_by_name_const(
const struct bt_field_class *fc, const char *name)
{
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_STRUCTURE,
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_STRUCTURE,
"Field class");
return (const void *)
borrow_named_field_class_from_container_field_class_by_name(
bt_field_class_structure_borrow_member_by_name(
struct bt_field_class *fc, const char *name)
{
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_STRUCTURE,
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_STRUCTURE,
"Field class");
return (void *)
borrow_named_field_class_from_container_field_class_by_name(
{
const struct bt_named_field_class *named_fc = (const void *) member;
- BT_ASSERT_PRE_NON_NULL(member, "Structure field class member");
+ BT_ASSERT_PRE_DEV_NON_NULL(member, "Structure field class member");
return named_fc->name->str;
}
{
const struct bt_named_field_class *named_fc = (const void *) member;
- BT_ASSERT_PRE_NON_NULL(member, "Structure field class member");
+ BT_ASSERT_PRE_DEV_NON_NULL(member, "Structure field class member");
return named_fc->fc;
}
{
struct bt_named_field_class *named_fc = (void *) member;
- BT_ASSERT_PRE_NON_NULL(member, "Structure field class member");
+ BT_ASSERT_PRE_DEV_NON_NULL(member, "Structure field class member");
return named_fc->fc;
}
BT_LOGD_STR("Creating default variant field class object.");
var_fc = g_new0(struct bt_field_class_variant, 1);
if (!var_fc) {
- BT_LOGE_STR("Failed to allocate one variant field class.");
+ BT_LIB_LOGE_APPEND_CAUSE(
+ "Failed to allocate one variant field class.");
goto error;
}
return (void *) var_fc;
}
-enum bt_field_class_status bt_field_class_variant_set_selector_field_class(
+enum bt_field_class_variant_set_selector_field_class_status
+bt_field_class_variant_set_selector_field_class(
struct bt_field_class *fc,
struct bt_field_class *selector_fc)
{
BT_ASSERT_PRE_NON_NULL(selector_fc, "Selector field class");
BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_VARIANT, "Field class");
BT_ASSERT_PRE_FC_IS_ENUM(selector_fc, "Selector field class");
- BT_ASSERT_PRE_FC_HOT(fc, "Variant field class");
+ BT_ASSERT_PRE_DEV_FC_HOT(fc, "Variant field class");
var_fc->selector_fc = selector_fc;
bt_object_get_no_null_check(selector_fc);
bt_field_class_freeze(selector_fc);
- return BT_FIELD_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
-enum bt_field_class_status bt_field_class_variant_append_option(
+enum bt_field_class_variant_append_option_status
+bt_field_class_variant_append_option(
struct bt_field_class *fc,
const char *name, struct bt_field_class *option_fc)
{
bt_field_class_variant_borrow_option_by_name_const(
const struct bt_field_class *fc, const char *name)
{
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_VARIANT, "Field class");
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_VARIANT,
+ "Field class");
return (const void *)
borrow_named_field_class_from_container_field_class_by_name(
(void *) fc, name);
bt_field_class_variant_borrow_option_by_name(
struct bt_field_class *fc, const char *name)
{
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_VARIANT, "Field class");
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_VARIANT, "Field class");
return (void *)
borrow_named_field_class_from_container_field_class_by_name(
(void *) fc, name);
{
const struct bt_field_class_variant *var_fc = (const void *) fc;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_VARIANT, "Field class");
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_VARIANT, "Field class");
return (uint64_t) var_fc->common.named_fcs->len;
}
bt_field_class_variant_borrow_option_by_index_const(
const struct bt_field_class *fc, uint64_t index)
{
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_VARIANT, "Field class");
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_VARIANT, "Field class");
return (const void *)
borrow_named_field_class_from_container_field_class_at_index(
(void *) fc, index);
bt_field_class_variant_borrow_option_by_index(
struct bt_field_class *fc, uint64_t index)
{
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_VARIANT, "Field class");
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_VARIANT, "Field class");
return (void *)
borrow_named_field_class_from_container_field_class_at_index(
(void *) fc, index);
{
const struct bt_named_field_class *named_fc = (const void *) option;
- BT_ASSERT_PRE_NON_NULL(option, "Variant field class option");
+ BT_ASSERT_PRE_DEV_NON_NULL(option, "Variant field class option");
return named_fc->name->str;
}
{
const struct bt_named_field_class *named_fc = (const void *) option;
- BT_ASSERT_PRE_NON_NULL(option, "Variant field class option");
+ BT_ASSERT_PRE_DEV_NON_NULL(option, "Variant field class option");
return named_fc->fc;
}
{
struct bt_named_field_class *named_fc = (void *) option;
- BT_ASSERT_PRE_NON_NULL(option, "Variant field class option");
+ BT_ASSERT_PRE_DEV_NON_NULL(option, "Variant field class option");
return named_fc->fc;
}
{
const struct bt_field_class_variant *var_fc = (const void *) fc;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_VARIANT,
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_VARIANT,
"Field class");
return var_fc->selector_field_path;
}
BT_LOGD_STR("Creating default static array field class object.");
array_fc = g_new0(struct bt_field_class_static_array, 1);
if (!array_fc) {
- BT_LOGE_STR("Failed to allocate one static array field class.");
+ BT_LIB_LOGE_APPEND_CAUSE(
+ "Failed to allocate one static array field class.");
goto error;
}
{
const struct bt_field_class_array *array_fc = (const void *) fc;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_IS_ARRAY(fc, "Field class");
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_IS_ARRAY(fc, "Field class");
return array_fc->element_fc;
}
{
struct bt_field_class_array *array_fc = (void *) fc;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_IS_ARRAY(fc, "Field class");
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_IS_ARRAY(fc, "Field class");
return array_fc->element_fc;
}
{
const struct bt_field_class_static_array *array_fc = (const void *) fc;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_STATIC_ARRAY,
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_STATIC_ARRAY,
"Field class");
return (uint64_t) array_fc->length;
}
BT_LOGD_STR("Creating default dynamic array field class object.");
array_fc = g_new0(struct bt_field_class_dynamic_array, 1);
if (!array_fc) {
- BT_LOGE_STR("Failed to allocate one dynamic array field class.");
+ BT_LIB_LOGE_APPEND_CAUSE(
+ "Failed to allocate one dynamic array field class.");
goto error;
}
return (void *) array_fc;
}
-enum bt_field_class_status bt_field_class_dynamic_array_set_length_field_class(
+enum bt_field_class_dynamic_array_set_length_field_class_status
+bt_field_class_dynamic_array_set_length_field_class(
struct bt_field_class *fc,
struct bt_field_class *length_fc)
{
BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY,
"Field class");
BT_ASSERT_PRE_FC_IS_UNSIGNED_INT(length_fc, "Length field class");
- BT_ASSERT_PRE_FC_HOT(fc, "Dynamic array field class");
+ BT_ASSERT_PRE_DEV_FC_HOT(fc, "Dynamic array field class");
array_fc->length_fc = length_fc;
bt_object_get_no_null_check(length_fc);
bt_field_class_freeze(length_fc);
- return BT_FIELD_CLASS_STATUS_OK;
+ return BT_FUNC_STATUS_OK;
}
const struct bt_field_path *
{
const struct bt_field_class_dynamic_array *seq_fc = (const void *) fc;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY,
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY,
"Field class");
return seq_fc->length_field_path;
}
BT_LOGD_STR("Creating default string field class object.");
string_fc = g_new0(struct bt_field_class_string, 1);
if (!string_fc) {
- BT_LOGE_STR("Failed to allocate one string field class.");
+ BT_LIB_LOGE_APPEND_CAUSE(
+ "Failed to allocate one string field class.");
goto error;
}
}
BT_HIDDEN
-void _bt_field_class_make_part_of_trace_class(const struct bt_field_class *c_fc)
+void bt_field_class_make_part_of_trace_class(const struct bt_field_class *c_fc)
{
struct bt_field_class *fc = (void *) c_fc;