projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: uninitialized return value on error
[babeltrace.git]
/
plugins
/
libctfcopytrace
/
clock-fields.c
diff --git
a/plugins/libctfcopytrace/clock-fields.c
b/plugins/libctfcopytrace/clock-fields.c
index f24206a27fb8023f9a279480c2cc27f6fef58a48..5d312a81125730c800d3d37163933d5f93baaf06 100644
(file)
--- a/
plugins/libctfcopytrace/clock-fields.c
+++ b/
plugins/libctfcopytrace/clock-fields.c
@@
-26,6
+26,9
@@
* SOFTWARE.
*/
* SOFTWARE.
*/
+#define BT_LOG_TAG "PLUGIN-CTFCOPYTRACE-LIB-CLOCK-FIELDS"
+#include "logging.h"
+
#include <babeltrace/ctf-ir/event.h>
#include <babeltrace/ctf-ir/packet.h>
#include <babeltrace/ctf-ir/event-class.h>
#include <babeltrace/ctf-ir/event.h>
#include <babeltrace/ctf-ir/packet.h>
#include <babeltrace/ctf-ir/event-class.h>
@@
-100,16
+103,14
@@
int update_header_clock_int_field_type(FILE *err, struct bt_ctf_field_type *type
ret = bt_ctf_field_type_integer_set_size(type, 64);
if (ret) {
ret = bt_ctf_field_type_integer_set_size(type, 64);
if (ret) {
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
+ BT_LOGE_STR("Failed to set integer size to 64.");
goto end;
}
ret = bt_ctf_field_type_integer_set_mapped_clock_class(type,
writer_clock_class);
if (ret) {
goto end;
}
ret = bt_ctf_field_type_integer_set_mapped_clock_class(type,
writer_clock_class);
if (ret) {
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
+ BT_LOGE_STR("Failed to map integer to clock_class.");
goto end;
}
goto end;
}
@@
-136,7
+137,6
@@
int find_update_clock_fields(FILE *err, struct bt_ctf_field_type *type,
case BT_CTF_FIELD_TYPE_ID_SEQUENCE:
return find_update_sequence_clock_fields(err, type,
writer_clock_class);
case BT_CTF_FIELD_TYPE_ID_SEQUENCE:
return find_update_sequence_clock_fields(err, type,
writer_clock_class);
- case BT_CTF_TYPE_ID_UNTAGGED_VARIANT:
case BT_CTF_FIELD_TYPE_ID_VARIANT:
return find_update_variant_clock_fields(err, type,
writer_clock_class);
case BT_CTF_FIELD_TYPE_ID_VARIANT:
return find_update_variant_clock_fields(err, type,
writer_clock_class);
@@
-167,15
+167,14
@@
int find_update_variant_clock_fields(FILE *err, struct bt_ctf_field_type *type,
ret = bt_ctf_field_type_variant_get_field(type,
&entry_name, &entry_type, i);
if (ret) {
ret = bt_ctf_field_type_variant_get_field(type,
&entry_name, &entry_type, i);
if (ret) {
- fprintf(err, "[error] %s in %s:%d\n",
- __func__, __FILE__, __LINE__);
+ BT_LOGE_STR("Failed to get variant field.");
goto error;
}
goto error;
}
+
ret = find_update_clock_fields(err, entry_type,
writer_clock_class);
if (ret) {
ret = find_update_clock_fields(err, entry_type,
writer_clock_class);
if (ret) {
- fprintf(err, "[error] %s in %s:%d\n",
- __func__, __FILE__, __LINE__);
+ BT_LOGE_STR("Failed to find clock fields.");
goto error;
}
BT_PUT(entry_type);
goto error;
}
BT_PUT(entry_type);
@@
-205,15
+204,14
@@
int find_update_struct_clock_fields(FILE *err, struct bt_ctf_field_type *type,
ret = bt_ctf_field_type_structure_get_field(type,
&entry_name, &entry_type, i);
if (ret) {
ret = bt_ctf_field_type_structure_get_field(type,
&entry_name, &entry_type, i);
if (ret) {
- fprintf(err, "[error] %s in %s:%d\n",
- __func__, __FILE__, __LINE__);
+ BT_LOGE_STR("Failed to get struct field.");
goto error;
}
goto error;
}
+
ret = find_update_clock_fields(err, entry_type,
writer_clock_class);
if (ret) {
ret = find_update_clock_fields(err, entry_type,
writer_clock_class);
if (ret) {
- fprintf(err, "[error] %s in %s:%d\n",
- __func__, __FILE__, __LINE__);
+ BT_LOGE_STR("Failed to find clock fields.");
goto error;
}
BT_PUT(entry_type);
goto error;
}
BT_PUT(entry_type);
@@
-236,16
+234,12
@@
int find_update_sequence_clock_fields(FILE *err, struct bt_ctf_field_type *type,
struct bt_ctf_field_type *entry_type = NULL;
entry_type = bt_ctf_field_type_sequence_get_element_type(type);
struct bt_ctf_field_type *entry_type = NULL;
entry_type = bt_ctf_field_type_sequence_get_element_type(type);
- if (!entry_type) {
- fprintf(err, "[error] %s in %s:%d\n",
- __func__, __FILE__, __LINE__);
- goto error;
- }
+ assert(entry_type);
+
ret = find_update_clock_fields(err, entry_type, writer_clock_class);
BT_PUT(entry_type);
if (ret) {
ret = find_update_clock_fields(err, entry_type, writer_clock_class);
BT_PUT(entry_type);
if (ret) {
- fprintf(err, "[error] %s in %s:%d\n",
- __func__, __FILE__, __LINE__);
+ BT_LOGE_STR("Failed to find clock fields.");
goto error;
}
goto error;
}
@@
-262,29
+256,20
@@
static
int find_update_array_clock_fields(FILE *err, struct bt_ctf_field_type *type,
struct bt_ctf_clock_class *writer_clock_class)
{
int find_update_array_clock_fields(FILE *err, struct bt_ctf_field_type *type,
struct bt_ctf_clock_class *writer_clock_class)
{
- int ret;
+ int ret
= 0
;
struct bt_ctf_field_type *entry_type = NULL;
entry_type = bt_ctf_field_type_array_get_element_type(type);
struct bt_ctf_field_type *entry_type = NULL;
entry_type = bt_ctf_field_type_array_get_element_type(type);
- if (!entry_type) {
- fprintf(err, "[error] %s in %s:%d\n",
- __func__, __FILE__, __LINE__);
- goto error;
- }
+ assert(entry_type);
+
ret = find_update_clock_fields(err, entry_type, writer_clock_class);
BT_PUT(entry_type);
if (ret) {
ret = find_update_clock_fields(err, entry_type, writer_clock_class);
BT_PUT(entry_type);
if (ret) {
- fprintf(err, "[error] %s in %s:%d\n",
- __func__, __FILE__, __LINE__);
+ BT_LOGE_STR("Failed to find clock fields.");
ret = -1;
goto end;
}
ret = -1;
goto end;
}
- ret = 0;
- goto end;
-
-error:
- ret = -1;
end:
return ret;
}
end:
return ret;
}
@@
-297,16
+282,12
@@
int find_update_enum_clock_fields(FILE *err, struct bt_ctf_field_type *type,
struct bt_ctf_field_type *entry_type = NULL;
entry_type = bt_ctf_field_type_enumeration_get_container_type(type);
struct bt_ctf_field_type *entry_type = NULL;
entry_type = bt_ctf_field_type_enumeration_get_container_type(type);
- if (!entry_type) {
- fprintf(err, "[error] %s in %s:%d\n",
- __func__, __FILE__, __LINE__);
- goto error;
- }
+ assert(entry_type);
+
ret = find_update_clock_fields(err, entry_type, writer_clock_class);
BT_PUT(entry_type);
if (ret) {
ret = find_update_clock_fields(err, entry_type, writer_clock_class);
BT_PUT(entry_type);
if (ret) {
- fprintf(err, "[error] %s in %s:%d\n",
- __func__, __FILE__, __LINE__);
+ BT_LOGE_STR("Failed to find clock fields.");
goto error;
}
goto error;
}
@@
-330,28
+311,23
@@
struct bt_ctf_field_type *override_header_type(FILE *err,
/* FIXME multi-clock? */
writer_clock_class = bt_ctf_trace_get_clock_class_by_index(writer_trace, 0);
/* FIXME multi-clock? */
writer_clock_class = bt_ctf_trace_get_clock_class_by_index(writer_trace, 0);
- if (!writer_clock_class) {
- fprintf(err, "[error] %s in %s:%d\n",
- __func__, __FILE__, __LINE__);
- goto error;
- }
+ assert(writer_clock_class);
new_type = bt_ctf_field_type_copy(type);
if (!new_type) {
new_type = bt_ctf_field_type_copy(type);
if (!new_type) {
- fprintf(err, "[error] %s in %s:%d\n",
- __func__, __FILE__, __LINE__);
+ BT_LOGE_STR("Failed to copy field type.");
goto error;
}
if (bt_ctf_field_type_get_type_id(new_type) != BT_CTF_FIELD_TYPE_ID_STRUCT) {
goto error;
}
if (bt_ctf_field_type_get_type_id(new_type) != BT_CTF_FIELD_TYPE_ID_STRUCT) {
- fprintf(err, "[error] Unexpected header field type\n");
+ BT_LOGE("Expected header field type to be struct: type=%d",
+ bt_ctf_field_type_get_type_id(new_type));
goto error;
}
ret = find_update_struct_clock_fields(err, new_type, writer_clock_class);
if (ret) {
goto error;
}
ret = find_update_struct_clock_fields(err, new_type, writer_clock_class);
if (ret) {
- fprintf(err, "[error] %s in %s:%d\n",
- __func__, __FILE__, __LINE__);
+ BT_LOGE_STR("Failed to find clock fields in struct.");
goto error;
}
BT_PUT(writer_clock_class);
goto error;
}
BT_PUT(writer_clock_class);
@@
-375,21
+351,22
@@
int copy_float_field(FILE *err, struct bt_ctf_field *field,
ret = bt_ctf_field_floating_point_get_value(field, &value);
if (ret) {
ret = bt_ctf_field_floating_point_get_value(field, &value);
if (ret) {
- ret = -1;
- fprintf(err, "[error] %s in %s:%d\n", __func__,
- __FILE__, __LINE__);
- goto end;
+ BT_LOGE_STR("Failed to get value.");
+ goto error;
}
}
+
ret = bt_ctf_field_floating_point_set_value(copy_field, value);
if (ret) {
ret = -1;
ret = bt_ctf_field_floating_point_set_value(copy_field, value);
if (ret) {
ret = -1;
- fprintf(err, "[error] %s in %s:%d\n", __func__,
- __FILE__, __LINE__);
+ BT_LOGE_STR("Failed to set floating point value.");
goto end;
}
ret = 0;
goto end;
}
ret = 0;
+ goto end;
+error:
+ ret = -1;
end:
return ret;
}
end:
return ret;
}
@@
-404,21
+381,22
@@
int copy_string_field(FILE *err, struct bt_ctf_field *field,
value = bt_ctf_field_string_get_value(field);
if (!value) {
value = bt_ctf_field_string_get_value(field);
if (!value) {
- ret = -1;
- fprintf(err, "[error] %s in %s:%d\n", __func__,
- __FILE__, __LINE__);
- goto end;
+ BT_LOGE_STR("Failed to get value.");
+ goto error;
}
}
+
ret = bt_ctf_field_string_set_value(copy_field, value);
if (ret) {
ret = -1;
ret = bt_ctf_field_string_set_value(copy_field, value);
if (ret) {
ret = -1;
- fprintf(err, "[error] %s in %s:%d\n", __func__,
- __FILE__, __LINE__);
+ BT_LOGE_STR("Failed to set string value.");
goto end;
}
ret = 0;
goto end;
}
ret = 0;
+ goto end;
+error:
+ ret = -1;
end:
return ret;
}
end:
return ret;
}
@@
-429,15
+407,10
@@
int copy_override_field(FILE *err, struct bt_ctf_event *event,
struct bt_ctf_field *copy_field)
{
struct bt_ctf_field_type *type = NULL;
struct bt_ctf_field *copy_field)
{
struct bt_ctf_field_type *type = NULL;
- int ret;
+ int ret
= 0
;
type = bt_ctf_field_get_type(field);
type = bt_ctf_field_get_type(field);
- if (!type) {
- ret = -1;
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
- goto end;
- }
+ assert(type);
switch (bt_ctf_field_type_get_type_id(type)) {
case BT_CTF_FIELD_TYPE_ID_INTEGER:
switch (bt_ctf_field_type_get_type_id(type)) {
case BT_CTF_FIELD_TYPE_ID_INTEGER:
@@
-466,7
+439,6
@@
int copy_override_field(FILE *err, struct bt_ctf_event *event,
ret = copy_find_clock_sequence_field(err, event, writer_event,
field, type, copy_field);
break;
ret = copy_find_clock_sequence_field(err, event, writer_event,
field, type, copy_field);
break;
- case BT_CTF_TYPE_ID_UNTAGGED_VARIANT:
case BT_CTF_FIELD_TYPE_ID_VARIANT:
ret = copy_find_clock_variant_field(err, event, writer_event,
field, type, copy_field);
case BT_CTF_FIELD_TYPE_ID_VARIANT:
ret = copy_find_clock_variant_field(err, event, writer_event,
field, type, copy_field);
@@
-477,10
+449,8
@@
int copy_override_field(FILE *err, struct bt_ctf_event *event,
break;
}
break;
}
- ret = 0;
BT_PUT(type);
BT_PUT(type);
-end:
return ret;
}
return ret;
}
@@
-493,27
+463,16
@@
int copy_find_clock_enum_field(FILE *err, struct bt_ctf_event *event,
struct bt_ctf_field *container = NULL, *copy_container = NULL;
container = bt_ctf_field_enumeration_get_container(field);
struct bt_ctf_field *container = NULL, *copy_container = NULL;
container = bt_ctf_field_enumeration_get_container(field);
- if (!container) {
- ret = -1;
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
- goto end;
- }
+ assert(container);
copy_container = bt_ctf_field_enumeration_get_container(copy_field);
copy_container = bt_ctf_field_enumeration_get_container(copy_field);
- if (!copy_container) {
- ret = -1;
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
- goto error;
- }
+ assert(copy_container);
ret = copy_override_field(err, event, writer_event, container,
copy_container);
if (ret) {
ret = -1;
ret = copy_override_field(err, event, writer_event, container,
copy_container);
if (ret) {
ret = -1;
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
+ BT_LOGE_STR("Failed to override enum field.");
goto error;
}
goto error;
}
@@
-538,31
+497,21
@@
int copy_find_clock_variant_field(FILE *err, struct bt_ctf_event *event,
struct bt_ctf_field *variant_field = NULL, *copy_variant_field = NULL;
tag = bt_ctf_field_variant_get_tag(field);
struct bt_ctf_field *variant_field = NULL, *copy_variant_field = NULL;
tag = bt_ctf_field_variant_get_tag(field);
- if (!tag) {
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
- goto error;
- }
+ assert(tag);
variant_field = bt_ctf_field_variant_get_field(field, tag);
if (!variant_field) {
variant_field = bt_ctf_field_variant_get_field(field, tag);
if (!variant_field) {
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
+ BT_LOGE_STR("Failed to get variant field.");
goto error;
}
copy_variant_field = bt_ctf_field_variant_get_field(copy_field, tag);
goto error;
}
copy_variant_field = bt_ctf_field_variant_get_field(copy_field, tag);
- if (!copy_variant_field) {
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
- goto error;
- }
+ assert(copy_variant_field);
ret = copy_override_field(err, event, writer_event, variant_field,
copy_variant_field);
if (ret) {
ret = copy_override_field(err, event, writer_event, variant_field,
copy_variant_field);
if (ret) {
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
+ BT_LOGE_STR("Failed to override variant field.");
goto error;
}
goto error;
}
@@
-590,23
+539,17
@@
int copy_find_clock_sequence_field(FILE *err,
struct bt_ctf_field *entry_field = NULL, *entry_copy = NULL;
length_field = bt_ctf_field_sequence_get_length(field);
struct bt_ctf_field *entry_field = NULL, *entry_copy = NULL;
length_field = bt_ctf_field_sequence_get_length(field);
- if (!length_field) {
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
- goto error;
- }
+ assert(length_field);
ret = bt_ctf_field_unsigned_integer_get_value(length_field, &count);
if (ret) {
ret = bt_ctf_field_unsigned_integer_get_value(length_field, &count);
if (ret) {
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
+ BT_LOGE("Failed to get value.");
goto error;
}
ret = bt_ctf_field_sequence_set_length(copy_field, length_field);
if (ret) {
goto error;
}
ret = bt_ctf_field_sequence_set_length(copy_field, length_field);
if (ret) {
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
+ BT_LOGE_STR("Failed to set sequence length.");
goto error;
}
BT_PUT(length_field);
goto error;
}
BT_PUT(length_field);
@@
-614,23
+557,17
@@
int copy_find_clock_sequence_field(FILE *err,
for (i = 0; i < count; i++) {
entry_field = bt_ctf_field_sequence_get_field(field, i);
if (!entry_field) {
for (i = 0; i < count; i++) {
entry_field = bt_ctf_field_sequence_get_field(field, i);
if (!entry_field) {
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
+ BT_LOGE_STR("Failed to get sequence field.");
goto error;
}
entry_copy = bt_ctf_field_sequence_get_field(copy_field, i);
goto error;
}
entry_copy = bt_ctf_field_sequence_get_field(copy_field, i);
- if (!entry_copy) {
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
- goto error;
- }
+ assert(entry_copy);
ret = copy_override_field(err, event, writer_event, entry_field,
entry_copy);
if (ret) {
ret = copy_override_field(err, event, writer_event, entry_field,
entry_copy);
if (ret) {
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
+ BT_LOGE_STR("Faield to override field in sequence.");
goto error;
}
BT_PUT(entry_field);
goto error;
}
BT_PUT(entry_field);
@@
-662,24
+599,19
@@
int copy_find_clock_array_field(FILE *err,
for (i = 0; i < count; i++) {
entry_field = bt_ctf_field_array_get_field(field, i);
if (!entry_field) {
for (i = 0; i < count; i++) {
entry_field = bt_ctf_field_array_get_field(field, i);
if (!entry_field) {
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
-
__LINE__
);
+ ret = -1;
+
BT_LOGE_STR("Failed to get array field."
);
goto error;
}
entry_copy = bt_ctf_field_array_get_field(copy_field, i);
goto error;
}
entry_copy = bt_ctf_field_array_get_field(copy_field, i);
- if (!entry_copy) {
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
- goto error;
- }
+ assert(entry_copy);
ret = copy_override_field(err, event, writer_event, entry_field,
entry_copy);
if (ret) {
ret = -1;
ret = copy_override_field(err, event, writer_event, entry_field,
entry_copy);
if (ret) {
ret = -1;
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
+ BT_LOGE_STR("Failed to override field in array.");
goto error;
}
BT_PUT(entry_field);
goto error;
}
BT_PUT(entry_field);
@@
-713,31
+645,24
@@
int copy_find_clock_struct_field(FILE *err,
entry_field = bt_ctf_field_structure_get_field_by_index(field, i);
if (!entry_field) {
entry_field = bt_ctf_field_structure_get_field_by_index(field, i);
if (!entry_field) {
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
+ BT_LOGE_STR("Failed to get struct field.");
goto error;
}
ret = bt_ctf_field_type_structure_get_field(type, &entry_name,
&entry_type, i);
if (ret) {
goto error;
}
ret = bt_ctf_field_type_structure_get_field(type, &entry_name,
&entry_type, i);
if (ret) {
- fprintf(err, "[error] %s in %s:%d\n",
- __func__, __FILE__, __LINE__);
+ BT_LOGE_STR("Failed to get struct field.");
goto error;
}
entry_copy = bt_ctf_field_structure_get_field_by_index(copy_field, i);
goto error;
}
entry_copy = bt_ctf_field_structure_get_field_by_index(copy_field, i);
- if (!entry_copy) {
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
- goto error;
- }
+ assert(entry_copy);
ret = copy_override_field(err, event, writer_event, entry_field,
entry_copy);
if (ret) {
ret = copy_override_field(err, event, writer_event, entry_field,
entry_copy);
if (ret) {
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
+ BT_LOGE_STR("Failed to override field in struct.");
goto error;
}
BT_PUT(entry_copy);
goto error;
}
BT_PUT(entry_copy);
@@
-769,37
+694,36
@@
int set_int_value(FILE *err, struct bt_ctf_field *field,
if (bt_ctf_field_type_integer_get_signed(type)) {
ret = bt_ctf_field_signed_integer_get_value(field, &value);
if (ret) {
if (bt_ctf_field_type_integer_get_signed(type)) {
ret = bt_ctf_field_signed_integer_get_value(field, &value);
if (ret) {
- ret = -1;
- fprintf(err, "[error] %s in %s:%d\n", __func__,
- __FILE__, __LINE__);
- goto end;
+ BT_LOGE("Failed to get value.");
+ goto error;
}
}
+
ret = bt_ctf_field_signed_integer_set_value(copy_field, value);
if (ret) {
ret = -1;
ret = bt_ctf_field_signed_integer_set_value(copy_field, value);
if (ret) {
ret = -1;
- fprintf(err, "[error] %s in %s:%d\n", __func__,
- __FILE__, __LINE__);
+ BT_LOGE_STR("Failed to set signed integer value.");
goto end;
}
} else {
ret = bt_ctf_field_unsigned_integer_get_value(field,
&uvalue);
if (ret) {
goto end;
}
} else {
ret = bt_ctf_field_unsigned_integer_get_value(field,
&uvalue);
if (ret) {
- ret = -1;
- fprintf(err, "[error] %s in %s:%d\n", __func__,
- __FILE__, __LINE__);
- goto end;
+ BT_LOGE("Failed to get value.");
+ goto error;
}
}
+
ret = bt_ctf_field_unsigned_integer_set_value(copy_field, uvalue);
if (ret) {
ret = -1;
ret = bt_ctf_field_unsigned_integer_set_value(copy_field, uvalue);
if (ret) {
ret = -1;
- fprintf(err, "[error] %s in %s:%d\n", __func__,
- __FILE__, __LINE__);
+ BT_LOGE_STR("Failed to set unsigned integer value.");
goto end;
}
}
ret = 0;
goto end;
}
}
ret = 0;
+ goto end;
+error:
+ ret = -1;
end:
return ret;
}
end:
return ret;
}
@@
-811,17
+735,13
@@
struct bt_ctf_clock_class *stream_class_get_clock_class(FILE *err,
struct bt_ctf_clock_class *clock_class = NULL;
trace = bt_ctf_stream_class_get_trace(stream_class);
struct bt_ctf_clock_class *clock_class = NULL;
trace = bt_ctf_stream_class_get_trace(stream_class);
- if (!trace) {
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
- goto end;
- }
+ assert(trace);
/* FIXME multi-clock? */
clock_class = bt_ctf_trace_get_clock_class_by_index(trace, 0);
bt_put(trace);
/* FIXME multi-clock? */
clock_class = bt_ctf_trace_get_clock_class_by_index(trace, 0);
bt_put(trace);
-end:
+
return clock_class;
}
return clock_class;
}
@@
-832,24
+752,15
@@
struct bt_ctf_clock_class *event_get_clock_class(FILE *err, struct bt_ctf_event
struct bt_ctf_clock_class *clock_class = NULL;
event_class = bt_ctf_event_get_class(event);
struct bt_ctf_clock_class *clock_class = NULL;
event_class = bt_ctf_event_get_class(event);
- if (!event_class) {
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
- goto end;
- }
+ assert(event_class);
stream_class = bt_ctf_event_class_get_stream_class(event_class);
BT_PUT(event_class);
stream_class = bt_ctf_event_class_get_stream_class(event_class);
BT_PUT(event_class);
- if (!stream_class) {
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
- goto end;
- }
+ assert(stream_class);
clock_class = stream_class_get_clock_class(err, stream_class);
bt_put(stream_class);
clock_class = stream_class_get_clock_class(err, stream_class);
bt_put(stream_class);
-end:
return clock_class;
}
return clock_class;
}
@@
-871,47
+782,35
@@
int copy_find_clock_int_field(FILE *err,
clock_value = bt_ctf_event_get_clock_value(event, clock_class);
BT_PUT(clock_class);
clock_value = bt_ctf_event_get_clock_value(event, clock_class);
BT_PUT(clock_class);
- if (!clock_value) {
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
- goto error;
- }
+ assert(clock_value);
ret = bt_ctf_clock_value_get_value(clock_value, &value);
BT_PUT(clock_value);
if (ret) {
ret = bt_ctf_clock_value_get_value(clock_value, &value);
BT_PUT(clock_value);
if (ret) {
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
+ BT_LOGE("Failed to get clock value.");
goto error;
}
ret = bt_ctf_field_unsigned_integer_set_value(copy_field, value);
if (ret) {
goto error;
}
ret = bt_ctf_field_unsigned_integer_set_value(copy_field, value);
if (ret) {
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
+ BT_LOGE_STR("Failed to set unsigned integer value.");
goto error;
}
writer_clock_class = event_get_clock_class(err, writer_event);
goto error;
}
writer_clock_class = event_get_clock_class(err, writer_event);
- if (!writer_clock_class) {
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
- goto error;
- }
+ assert(writer_clock_class);
writer_clock_value = bt_ctf_clock_value_create(writer_clock_class, value);
BT_PUT(writer_clock_class);
if (!writer_clock_value) {
writer_clock_value = bt_ctf_clock_value_create(writer_clock_class, value);
BT_PUT(writer_clock_class);
if (!writer_clock_value) {
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
+ BT_LOGE_STR("Failed to create clock value.");
goto error;
}
ret = bt_ctf_event_set_clock_value(writer_event, writer_clock_value);
BT_PUT(writer_clock_value);
if (ret) {
goto error;
}
ret = bt_ctf_event_set_clock_value(writer_event, writer_clock_value);
BT_PUT(writer_clock_value);
if (ret) {
- fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
- __LINE__);
+ BT_LOGE_STR("Failed to set clock value.");
goto error;
}
goto error;
}
This page took
0.031321 seconds
and
4
git commands to generate.