API fix/breakage : reexporting bt_ctf_event
[babeltrace.git] / formats / ctf / events.c
index 15882eeffd20c2400de32af077e2879402165095..b33796bc2dfbc9580e46b57d88848de266445862 100644 (file)
  */
 __thread int bt_ctf_last_field_error = 0;
 
-const struct definition *bt_ctf_get_top_level_scope(const struct bt_ctf_event *event,
+const struct definition *bt_ctf_get_top_level_scope(const struct bt_ctf_event *ctf_event,
                enum bt_ctf_scope scope)
 {
        struct definition *tmp = NULL;
+       struct ctf_event_definition *event = ctf_event->parent;
 
        switch (scope) {
        case BT_TRACE_PACKET_HEADER:
@@ -69,16 +70,12 @@ const struct definition *bt_ctf_get_top_level_scope(const struct bt_ctf_event *e
                        tmp = &event->stream->stream_event_context->p;
                break;
        case BT_EVENT_CONTEXT:
-               if (!event->event)
-                       goto error;
-               if (event->event->event_context)
-                       tmp = &event->event->event_context->p;
+               if (event->event_context)
+                       tmp = &event->event_context->p;
                break;
        case BT_EVENT_FIELDS:
-               if (!event->event)
-                       goto error;
-               if (event->event->event_fields)
-                       tmp = &event->event->event_fields->p;
+               if (event->event_fields)
+                       tmp = &event->event_fields->p;
                break;
        }
        return tmp;
@@ -87,7 +84,7 @@ error:
        return NULL;
 }
 
-const struct definition *bt_ctf_get_field(const struct bt_ctf_event *event,
+const struct definition *bt_ctf_get_field(const struct bt_ctf_event *ctf_event,
                const struct definition *scope,
                const char *field)
 {
@@ -118,7 +115,7 @@ const struct definition *bt_ctf_get_field(const struct bt_ctf_event *event,
        return NULL;
 }
 
-const struct definition *bt_ctf_get_index(const struct bt_ctf_event *event,
+const struct definition *bt_ctf_get_index(const struct bt_ctf_event *ctf_event,
                const struct definition *field,
                unsigned int index)
 {
@@ -138,10 +135,11 @@ const struct definition *bt_ctf_get_index(const struct bt_ctf_event *event,
        return ret;
 }
 
-const char *bt_ctf_event_name(const struct bt_ctf_event *event)
+const char *bt_ctf_event_name(const struct bt_ctf_event *ctf_event)
 {
-       struct ctf_event *event_class;
-       struct ctf_stream_class *stream_class;
+       struct ctf_event_declaration *event_class;
+       struct ctf_stream_declaration *stream_class;
+       struct ctf_event_definition *event = ctf_event->parent;
 
        if (!event)
                return NULL;
@@ -165,7 +163,7 @@ enum ctf_type_id bt_ctf_field_type(const struct definition *def)
        return CTF_TYPE_UNKNOWN;
 }
 
-int bt_ctf_get_field_list(const struct bt_ctf_event *event,
+int bt_ctf_get_field_list(const struct bt_ctf_event *ctf_event,
                const struct definition *scope,
                struct definition const * const **list,
                unsigned int *count)
@@ -251,11 +249,12 @@ error:
        return -1;
 }
 
-struct bt_context *bt_ctf_event_get_context(const struct bt_ctf_event *event)
+struct bt_context *bt_ctf_event_get_context(const struct bt_ctf_event *ctf_event)
 {
        struct bt_context *ret = NULL;
        struct ctf_file_stream *cfs;
        struct ctf_trace *trace;
+       struct ctf_event_definition *event = ctf_event->parent;
 
        cfs = container_of(event->stream, struct ctf_file_stream,
                        parent);
@@ -266,11 +265,12 @@ struct bt_context *bt_ctf_event_get_context(const struct bt_ctf_event *event)
        return ret;
 }
 
-int bt_ctf_event_get_handle_id(const struct bt_ctf_event *event)
+int bt_ctf_event_get_handle_id(const struct bt_ctf_event *ctf_event)
 {
        int ret = -1;
        struct ctf_file_stream *cfs;
        struct ctf_trace *trace;
+       struct ctf_event_definition *event = ctf_event->parent;
 
        cfs = container_of(event->stream, struct ctf_file_stream,
                        parent);
@@ -281,8 +281,9 @@ int bt_ctf_event_get_handle_id(const struct bt_ctf_event *event)
        return ret;
 }
 
-uint64_t bt_ctf_get_timestamp_raw(const struct bt_ctf_event *event)
+uint64_t bt_ctf_get_timestamp_raw(const struct bt_ctf_event *ctf_event)
 {
+       struct ctf_event_definition *event = ctf_event->parent;
        if (event && event->stream->has_timestamp)
                return ctf_get_timestamp_raw(event->stream,
                                event->stream->timestamp);
@@ -290,8 +291,9 @@ uint64_t bt_ctf_get_timestamp_raw(const struct bt_ctf_event *event)
                return -1ULL;
 }
 
-uint64_t bt_ctf_get_timestamp(const struct bt_ctf_event *event)
+uint64_t bt_ctf_get_timestamp(const struct bt_ctf_event *ctf_event)
 {
+       struct ctf_event_definition *event = ctf_event->parent;
        if (event && event->stream->has_timestamp)
                return ctf_get_timestamp(event->stream,
                                event->stream->timestamp);
This page took 0.024709 seconds and 4 git commands to generate.