uint64_t *ts)
{
unsigned long sec, usec;
- int ret;
if (!s_timestamp)
return;
/* Only need to be executed on first pass (dummy) */
if (pos->dummy) {
+ int ret;
+
/* Extract time from input line */
ret = sscanf(line, "[%lu.%lu] ", &sec, &usec);
if (ret == 2) {
uint64_t ts = 0;
printf_debug("read: %s\n", line);
-retry:
- ctf_dummy_pos(pos, &dummy);
- write_event_header(&dummy, line, &tline, len, &tlen, &ts);
- ctf_align_pos(&dummy, sizeof(uint8_t) * CHAR_BIT);
- ctf_move_pos(&dummy, tlen * CHAR_BIT);
- if (ctf_pos_packet(&dummy)) {
- ctf_pos_pad_packet(pos);
- write_packet_header(pos, s_uuid);
- write_packet_context(pos);
- if (attempt++ == 1) {
- fprintf(stderr, "[Error] Line too large for packet size (%" PRIu64 "kB) (discarded)\n",
- pos->packet_size / CHAR_BIT / 1024);
- return;
+
+ for (;;) {
+ ctf_dummy_pos(pos, &dummy);
+ write_event_header(&dummy, line, &tline, len, &tlen, &ts);
+ ctf_align_pos(&dummy, sizeof(uint8_t) * CHAR_BIT);
+ ctf_move_pos(&dummy, tlen * CHAR_BIT);
+ if (ctf_pos_packet(&dummy)) {
+ ctf_pos_pad_packet(pos);
+ write_packet_header(pos, s_uuid);
+ write_packet_context(pos);
+ if (attempt++ == 1) {
+ fprintf(stderr, "[Error] Line too large for packet size (%" PRIu64 "kB) (discarded)\n",
+ pos->packet_size / CHAR_BIT / 1024);
+ return;
+ }
+ continue;
+ } else {
+ break;
}
- goto retry;
}
write_event_header(pos, line, &tline, len, &tlen, &ts);
GArray *trace_ids;
int ret = 0;
- int i;
/* Should lock traversed_paths mutex here if used in multithread */
/* Process the array if ntfw did not return a fatal error */
if (ret >= 0) {
+ int i;
+
for (i = 0; i < traversed_paths->len; i++) {
GString *trace_path = g_ptr_array_index(traversed_paths,
i);
enum_definition->integer;
struct ctf_text_stream_pos *pos = ctf_text_pos(ppos);
GArray *qs;
- int i, ret;
+ int ret;
int field_nr_saved;
if (!print_field(definition))
qs = enum_definition->value;
if (qs) {
+ int i;
+
for (i = 0; i < qs->len; i++) {
GQuark q = g_array_index(qs, GQuark, i);
const char *str = g_quark_to_string(q);
int ctf_fini_pos(struct ctf_stream_pos *pos)
{
- int ret;
-
if (pos->prot == PROT_WRITE && pos->content_size_loc)
*pos->content_size_loc = pos->offset;
if (pos->base_mma) {
+ int ret;
+
/* unmap old base */
ret = munmap_align(pos->base_mma);
if (ret) {
int ctf_close_trace(struct trace_descriptor *tdp)
{
struct ctf_trace *td = container_of(tdp, struct ctf_trace, parent);
- int i, ret;
+ int ret;
if (td->streams) {
+ int i;
+
for (i = 0; i < td->streams->len; i++) {
struct ctf_stream_declaration *stream;
int j;
struct declaration_untagged_variant *untagged_variant_declaration;
struct declaration_variant *variant_declaration;
struct ctf_node *iter;
- int ret;
/*
* For named variant (without body), lookup in
}
untagged_variant_declaration = untagged_variant_declaration_new(declaration_scope);
bt_list_for_each_entry(iter, declaration_list, siblings) {
+ int ret;
+
ret = ctf_variant_declaration_list_visit(fd, depth + 1, iter,
untagged_variant_declaration, trace);
if (ret)
goto error;
}
if (name) {
+ int ret;
+
ret = register_variant_declaration(g_quark_from_string(name),
untagged_variant_declaration,
declaration_scope);
struct last_enum_value last_value;
struct ctf_node *iter;
GQuark dummy_id;
- int ret;
/*
* For named enum (without body), lookup in
last_value.u.u = 0;
}
bt_list_for_each_entry(iter, enumerator_list, siblings) {
+ int ret;
+
ret = ctf_enumerator_list_visit(fd, depth + 1, iter, enum_declaration,
&last_value);
if (ret)
goto error;
}
if (name) {
+ int ret;
+
ret = register_enum_declaration(g_quark_from_string(name),
enum_declaration,
declaration_scope);
int ctf_destroy_metadata(struct ctf_trace *trace)
{
- int i, j, k;
+ int i;
struct ctf_file_stream *metadata_stream;
if (trace->streams) {
for (i = 0; i < trace->streams->len; i++) {
struct ctf_stream_declaration *stream;
+ int j;
stream = g_ptr_array_index(trace->streams, i);
if (!stream)
continue;
for (j = 0; j < stream->streams->len; j++) {
struct ctf_stream_definition *stream_def;
+ int k;
stream_def = g_ptr_array_index(stream->streams, j);
if (!stream_def)
*static_double_declaration;
struct pos_len {
- size_t sign_start, exp_start, mantissa_start, len;
+ size_t len;
};
static void float_lock(void)
container_of(declaration, struct declaration_float, p);
struct definition_float *_float;
struct definition *tmp;
- int ret;
_float = g_new(struct definition_float, 1);
declaration_ref(&float_declaration->p);
_float->p.name = field_name;
_float->value = 0.0;
if (parent_scope) {
+ int ret;
+
ret = register_field_definition(field_name, &_float->p,
parent_scope);
assert(!ret);
static int is_path_child_of(GArray *path, GArray *maybe_parent)
{
- int i, ret;
+ int ret;
if (babeltrace_debug) {
- int need_dot = 0;
+ int i, need_dot = 0;
printf_debug("Is path \"");
for (i = 0; i < path->len; need_dot = 1, i++)
GQuark path;
GString *str;
gchar *c_str;
- int i;
int need_dot = 0;
str = g_string_new("");
g_string_append(str, root_name);
need_dot = 1;
} else if (parent_scope) {
+ int i;
+
for (i = 0; i < parent_scope->scope_path->len; i++) {
GQuark q = g_array_index(parent_scope->scope_path,
GQuark, i);