/*
- * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * SPDX-License-Identifier: MIT
*
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
*/
#define BT_LOG_TAG "CTF-WRITER/FIELDS"
#include <float.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <babeltrace2-ctf-writer/object.h>
/* Create all fields contained in the structure field. */
for (i = 0; i < structure_type->fields->len; i++) {
- struct bt_ctf_field_common *field;
+ struct bt_ctf_field_common *member_field;
struct bt_ctf_field_type_common_structure_field *struct_field =
BT_CTF_FIELD_TYPE_COMMON_STRUCTURE_FIELD_AT_INDEX(
structure_type, i);
- field = field_create_func(struct_field->type);
- if (!field) {
+ member_field = field_create_func(struct_field->type);
+ if (!member_field) {
BT_LOGE("Failed to create structure field's member: name=\"%s\", index=%zu",
g_quark_to_string(struct_field->name), i);
ret = -1;
goto end;
}
- g_ptr_array_index(structure->fields, i) = field;
+ g_ptr_array_index(structure->fields, i) = member_field;
}
BT_LOGD("Initialized common structure field object: addr=%p, ft-addr=%p",
/* Create all fields contained in the variant field. */
for (i = 0; i < variant_type->choices->len; i++) {
- struct bt_ctf_field_common *field;
+ struct bt_ctf_field_common *member_field;
struct bt_ctf_field_type_common_variant_choice *var_choice =
BT_CTF_FIELD_TYPE_COMMON_VARIANT_CHOICE_AT_INDEX(
variant_type, i);
- field = field_create_func(var_choice->type);
- if (!field) {
+ member_field = field_create_func(var_choice->type);
+ if (!member_field) {
BT_LOGE("Failed to create variant field's member: name=\"%s\", index=%zu",
g_quark_to_string(var_choice->name), i);
ret = -1;
goto end;
}
- g_ptr_array_index(variant->fields, i) = field;
+ g_ptr_array_index(variant->fields, i) = member_field;
}
BT_LOGD("Initialized common variant field object: addr=%p, ft-addr=%p",
byte_order == BT_CTF_BYTE_ORDER_LITTLE_ENDIAN ?
LITTLE_ENDIAN : BIG_ENDIAN);
} else {
- abort();
+ bt_common_abort();
}
if (G_UNLIKELY(ret)) {