X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=formats%2Fctf-text%2Fctf-text.c;h=f1ddbaf5e77b18f2f3855d9f7f2d23a708efe949;hb=70bd0a12b09ce7f233189cf07e090fda593ebc48;hp=361c527cce7a90d491a04b08a7d71f706bc19c62;hpb=42dc00b7cd26b1d33e80aaeffc744eb45093a14d;p=babeltrace.git diff --git a/formats/ctf-text/ctf-text.c b/formats/ctf-text/ctf-text.c index 361c527c..f1ddbaf5 100644 --- a/formats/ctf-text/ctf-text.c +++ b/formats/ctf-text/ctf-text.c @@ -3,7 +3,9 @@ * * CTF Text Format registration. * - * Copyright 2010, 2011 - Mathieu Desnoyers + * Copyright 2010-2011 EfficiOS Inc. and Linux Foundation + * + * Author: Mathieu Desnoyers * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -19,7 +21,7 @@ #include #include #include -#include +#include #include #include #include @@ -100,35 +102,10 @@ int ctf_text_write_event(struct stream_pos *ppos, int field_nr_saved; struct ctf_event *event_class; struct ctf_stream_event *event; - uint64_t id = 0; + uint64_t id; int ret; - /* print event header */ - if (stream->stream_event_header) { - struct definition_integer *integer_definition; - struct definition *variant; - - /* lookup event id */ - integer_definition = lookup_integer(&stream->stream_event_header->p, "id", FALSE); - if (integer_definition) { - id = integer_definition->value._unsigned; - } else { - struct definition_enum *enum_definition; - - enum_definition = lookup_enum(&stream->stream_event_header->p, "id", FALSE); - if (enum_definition) { - id = enum_definition->integer->value._unsigned; - } - } - - variant = lookup_variant(&stream->stream_event_header->p, "v"); - if (variant) { - integer_definition = lookup_integer(variant, "id", FALSE); - if (integer_definition) { - id = integer_definition->value._unsigned; - } - } - } + id = stream->event_id; if (id >= stream_class->events_by_id->len) { fprintf(stdout, "[error] Event id %" PRIu64 " is outside range.\n", id); @@ -145,7 +122,7 @@ int ctf_text_write_event(struct stream_pos *ppos, return -EINVAL; } - if (stream->timestamp) { + if (stream->has_timestamp) { if (pos->print_names) fprintf(pos->fp, "timestamp = "); else