BT_ASSERT(bt_field_class_has_known_type(fc));
field = field_create_funcs[fc->type](fc);
if (!field) {
- BT_LIB_LOGE("Cannot create field object from field class: "
+ BT_LIB_LOGE_APPEND_CAUSE("Cannot create field object from field class: "
"%![fc-]+F", fc);
goto end;
}
BT_LIB_LOGD("Creating integer field object: %![fc-]+F", fc);
int_field = g_new0(struct bt_field_integer, 1);
if (!int_field) {
- BT_LOGE_STR("Failed to allocate one integer field.");
+ BT_LIB_LOGE_APPEND_CAUSE(
+ "Failed to allocate one integer field.");
goto end;
}
BT_LIB_LOGD("Creating real field object: %![fc-]+F", fc);
real_field = g_new0(struct bt_field_real, 1);
if (!real_field) {
- BT_LOGE_STR("Failed to allocate one real field.");
+ BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate one real field.");
goto end;
}
BT_LIB_LOGD("Creating string field object: %![fc-]+F", fc);
string_field = g_new0(struct bt_field_string, 1);
if (!string_field) {
- BT_LOGE_STR("Failed to allocate one string field.");
+ BT_LIB_LOGE_APPEND_CAUSE(
+ "Failed to allocate one string field.");
goto end;
}
string_field->buf = g_array_sized_new(FALSE, FALSE,
sizeof(char), 1);
if (!string_field->buf) {
- BT_LOGE_STR("Failed to allocate a GArray.");
+ BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate a GArray.");
BT_OBJECT_PUT_REF_AND_RESET(string_field);
goto end;
}
*fields = g_ptr_array_new_with_free_func(
(GDestroyNotify) bt_field_destroy);
if (!*fields) {
- BT_LOGE_STR("Failed to allocate a GPtrArray.");
+ BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate a GPtrArray.");
ret = -1;
goto end;
}
field = bt_field_create(named_fc->fc);
if (!field) {
- BT_LIB_LOGE("Failed to create structure member or variant option field: "
+ BT_LIB_LOGE_APPEND_CAUSE(
+ "Failed to create structure member or variant option field: "
"name=\"%s\", %![fc-]+F",
named_fc->name->str, named_fc->fc);
ret = -1;
BT_LIB_LOGD("Creating structure field object: %![fc-]+F", fc);
struct_field = g_new0(struct bt_field_structure, 1);
if (!struct_field) {
- BT_LOGE_STR("Failed to allocate one structure field.");
+ BT_LIB_LOGE_APPEND_CAUSE(
+ "Failed to allocate one structure field.");
goto end;
}
if (create_fields_from_named_field_classes((void *) fc,
&struct_field->fields)) {
- BT_LIB_LOGE("Cannot create structure member fields: "
- "%![fc-]+F", fc);
+ BT_LIB_LOGE_APPEND_CAUSE(
+ "Cannot create structure member fields: %![fc-]+F", fc);
BT_OBJECT_PUT_REF_AND_RESET(struct_field);
goto end;
}
BT_LIB_LOGD("Creating variant field object: %![fc-]+F", fc);
var_field = g_new0(struct bt_field_variant, 1);
if (!var_field) {
- BT_LOGE_STR("Failed to allocate one variant field.");
+ BT_LIB_LOGE_APPEND_CAUSE(
+ "Failed to allocate one variant field.");
goto end;
}
if (create_fields_from_named_field_classes((void *) fc,
&var_field->fields)) {
- BT_LIB_LOGE("Cannot create variant member fields: "
+ BT_LIB_LOGE_APPEND_CAUSE("Cannot create variant member fields: "
"%![fc-]+F", fc);
BT_OBJECT_PUT_REF_AND_RESET(var_field);
goto end;
array_fc = (void *) array_field->common.class;
array_field->fields = g_ptr_array_sized_new(array_field->length);
if (!array_field->fields) {
- BT_LOGE_STR("Failed to allocate a GPtrArray.");
+ BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate a GPtrArray.");
ret = -1;
goto end;
}
array_field->fields->pdata[i] = bt_field_create(
array_fc->element_fc);
if (!array_field->fields->pdata[i]) {
- BT_LIB_LOGE("Cannot create array field's element field: "
+ BT_LIB_LOGE_APPEND_CAUSE(
+ "Cannot create array field's element field: "
"index=%" PRIu64 ", %![fc-]+F", i, array_fc);
ret = -1;
goto end;
BT_LIB_LOGD("Creating static array field object: %![fc-]+F", fc);
array_field = g_new0(struct bt_field_array, 1);
if (!array_field) {
- BT_LOGE_STR("Failed to allocate one static array field.");
+ BT_LIB_LOGE_APPEND_CAUSE(
+ "Failed to allocate one static array field.");
goto end;
}
array_field->length = array_fc->length;
if (init_array_field_fields(array_field)) {
- BT_LIB_LOGE("Cannot create static array fields: "
+ BT_LIB_LOGE_APPEND_CAUSE("Cannot create static array fields: "
"%![fc-]+F", fc);
BT_OBJECT_PUT_REF_AND_RESET(array_field);
goto end;
BT_LIB_LOGD("Creating dynamic array field object: %![fc-]+F", fc);
array_field = g_new0(struct bt_field_array, 1);
if (!array_field) {
- BT_LOGE_STR("Failed to allocate one dynamic array field.");
+ BT_LIB_LOGE_APPEND_CAUSE(
+ "Failed to allocate one dynamic array field.");
goto end;
}
init_field((void *) array_field, fc, &array_field_methods);
if (init_array_field_fields(array_field)) {
- BT_LIB_LOGE("Cannot create dynamic array fields: "
+ BT_LIB_LOGE_APPEND_CAUSE("Cannot create dynamic array fields: "
"%![fc-]+F", fc);
BT_OBJECT_PUT_REF_AND_RESET(array_field);
goto end;
array_fc->element_fc);
if (!elem_field) {
- BT_LIB_LOGE("Cannot create element field for "
+ BT_LIB_LOGE_APPEND_CAUSE(
+ "Cannot create element field for "
"dynamic array field: "
"index=%" PRIu64 ", "
"%![array-field-]+f", i, field);