#include <babeltrace/types.h>
#include <babeltrace/values-internal.h>
#include <inttypes.h>
+#include <stdlib.h>
static
void bt_ctf_event_class_destroy(struct bt_object *obj);
BT_LOGD("Creating event class object: name=\"%s\"",
name);
- if (bt_ctf_validate_identifier(name)) {
- BT_LOGW("Invalid parameter: event class's name is not a valid CTF identifier: "
- "name=\"%s\"", name);
- goto error;
- }
-
event_class = g_new0(struct bt_ctf_event_class, 1);
if (!event_class) {
BT_LOGE_STR("Failed to allocate one event class.");
goto error;
}
- event_class->context = bt_ctf_field_type_structure_create();
- if (!event_class->context) {
- BT_LOGE_STR("Cannot create event class's initial context field type object.");
- goto error;
- }
-
event_class->attributes = bt_ctf_attributes_create();
if (!event_class->attributes) {
BT_LOGE_STR("Cannot create event class's attributes object.");
}
ret = bt_ctf_attributes_get_field_name(event_class->attributes, index);
- if (ret) {
+ if (!ret) {
BT_LOGW("Cannot get event class's attribute name by index: "
"addr=%p, name=\"%s\", id=%" PRId64 ", index=%" PRIu64,
event_class, bt_ctf_event_class_get_name(event_class),
}
ret = bt_ctf_attributes_get_field_value(event_class->attributes, index);
- if (ret) {
+ if (!ret) {
BT_LOGW("Cannot get event class's attribute value by index: "
"addr=%p, name=\"%s\", id=%" PRId64 ", index=%" PRIu64,
event_class, bt_ctf_event_class_get_name(event_class),
struct bt_value *ret;
if (!event_class || !name) {
- BT_LOGW("Invalid parameter: event class or name is NULL: ",
+ BT_LOGW("Invalid parameter: event class or name is NULL: "
"event-class-addr=%p, name-addr=%p",
event_class, name);
ret = NULL;
ret = bt_ctf_attributes_get_field_value_by_name(event_class->attributes,
name);
- if (ret) {
+ if (!ret) {
BT_LOGV("Cannot find event class's attribute: "
"addr=%p, event-class-name=\"%s\", id=%" PRId64 ", "
"attr-name=\"%s\"",
struct bt_ctf_field_type *field_type = NULL;
if (!event_class || !name) {
- BT_LOGW("Invalid parameter: event class or name is NULL: ",
+ BT_LOGW("Invalid parameter: event class or name is NULL: "
"event-class-addr=%p, name-addr=%p",
event_class, name);
goto end;
bt_ctf_event_class_get_id(event_class));
BT_LOGD_STR("Destroying event class's attributes.");
bt_ctf_attributes_destroy(event_class->attributes);
- BT_LOGD_STR("Putting event class's context field type.");
+ BT_LOGD_STR("Putting context field type.");
bt_put(event_class->context);
- BT_LOGD_STR("Putting event class's payload field type.");
+ BT_LOGD_STR("Putting payload field type.");
bt_put(event_class->fields);
g_free(event_class);
}
default:
/* should never happen */
- assert(BT_FALSE);
+ abort();
break;
}