ctf.fs: bt_ctf_notif_iter_create(): assert() that all medops exist
[babeltrace.git] / formats / ctf / ctf.c
index 4c3e30294a15f8756ffec66bb48bfc43b8c5690a..475d6f72f3e3af0936b078af14c448926fc947b0 100644 (file)
@@ -159,6 +159,14 @@ struct bt_format ctf_format = {
        .convert_index_timestamp = ctf_convert_index_timestamp,
 };
 
+void bt_ctf_hook(void)
+{
+       /*
+        * Dummy function to prevent the linker from discarding this format as
+        * "unused" in static builds.
+        */
+}
+
 static
 int ctf_timestamp_begin(struct bt_trace_descriptor *descriptor,
                struct bt_trace_handle *handle, enum bt_clock_type type,
@@ -1407,7 +1415,7 @@ int ctf_trace_metadata_stream_read(struct ctf_trace *td, FILE **fp,
         * because its size includes garbage at the end (after final
         * \0). This is the allocated size, not the actual string size.
         */
-       out = babeltrace_open_memstream(buf, &size);
+       out = bt_open_memstream(buf, &size);
        if (out == NULL) {
                perror("Metadata open_memstream");
                return -errno;
@@ -1423,7 +1431,7 @@ int ctf_trace_metadata_stream_read(struct ctf_trace *td, FILE **fp,
                }
        }
        /* close to flush the buffer */
-       ret = babeltrace_close_memstream(buf, &size, out);
+       ret = bt_close_memstream(buf, &size, out);
        if (ret < 0) {
                int closeret;
 
@@ -1445,7 +1453,7 @@ int ctf_trace_metadata_stream_read(struct ctf_trace *td, FILE **fp,
                *fp = NULL;
                return -ENOENT;
        }
-       *fp = babeltrace_fmemopen(*buf, buflen, "rb");
+       *fp = bt_fmemopen(*buf, buflen, "rb");
        if (!*fp) {
                perror("Metadata fmemopen");
                return -errno;
@@ -1789,7 +1797,7 @@ begin:
                        fprintf(stderr, "[error] Unable to read packet header: %s\n", strerror(-ret));
                        return ret;
                }
-               len_index = bt_struct_declaration_lookup_field_index(file_stream->parent.trace_packet_header->declaration, g_quark_from_static_string("magic"));
+               len_index = bt_struct_declaration_lookup_field_index(file_stream->parent.trace_packet_header->declaration, g_quark_from_string("magic"));
                if (len_index >= 0) {
                        struct bt_definition *field;
                        uint64_t magic;
@@ -1806,7 +1814,7 @@ begin:
                }
 
                /* check uuid */
-               len_index = bt_struct_declaration_lookup_field_index(file_stream->parent.trace_packet_header->declaration, g_quark_from_static_string("uuid"));
+               len_index = bt_struct_declaration_lookup_field_index(file_stream->parent.trace_packet_header->declaration, g_quark_from_string("uuid"));
                if (len_index >= 0) {
                        struct definition_array *defarray;
                        struct bt_definition *field;
@@ -1831,7 +1839,7 @@ begin:
                        }
                }
 
-               len_index = bt_struct_declaration_lookup_field_index(file_stream->parent.trace_packet_header->declaration, g_quark_from_static_string("stream_id"));
+               len_index = bt_struct_declaration_lookup_field_index(file_stream->parent.trace_packet_header->declaration, g_quark_from_string("stream_id"));
                if (len_index >= 0) {
                        struct bt_definition *field;
 
@@ -1862,7 +1870,7 @@ begin:
                        return ret;
                }
                /* read packet size from header */
-               len_index = bt_struct_declaration_lookup_field_index(file_stream->parent.stream_packet_context->declaration, g_quark_from_static_string("packet_size"));
+               len_index = bt_struct_declaration_lookup_field_index(file_stream->parent.stream_packet_context->declaration, g_quark_from_string("packet_size"));
                if (len_index >= 0) {
                        struct bt_definition *field;
 
@@ -1874,7 +1882,7 @@ begin:
                }
 
                /* read content size from header */
-               len_index = bt_struct_declaration_lookup_field_index(file_stream->parent.stream_packet_context->declaration, g_quark_from_static_string("content_size"));
+               len_index = bt_struct_declaration_lookup_field_index(file_stream->parent.stream_packet_context->declaration, g_quark_from_string("content_size"));
                if (len_index >= 0) {
                        struct bt_definition *field;
 
@@ -1886,7 +1894,7 @@ begin:
                }
 
                /* read timestamp begin from header */
-               len_index = bt_struct_declaration_lookup_field_index(file_stream->parent.stream_packet_context->declaration, g_quark_from_static_string("timestamp_begin"));
+               len_index = bt_struct_declaration_lookup_field_index(file_stream->parent.stream_packet_context->declaration, g_quark_from_string("timestamp_begin"));
                if (len_index >= 0) {
                        struct bt_definition *field;
 
@@ -1901,7 +1909,7 @@ begin:
                }
 
                /* read timestamp end from header */
-               len_index = bt_struct_declaration_lookup_field_index(file_stream->parent.stream_packet_context->declaration, g_quark_from_static_string("timestamp_end"));
+               len_index = bt_struct_declaration_lookup_field_index(file_stream->parent.stream_packet_context->declaration, g_quark_from_string("timestamp_end"));
                if (len_index >= 0) {
                        struct bt_definition *field;
 
@@ -1916,7 +1924,7 @@ begin:
                }
 
                /* read events discarded from header */
-               len_index = bt_struct_declaration_lookup_field_index(file_stream->parent.stream_packet_context->declaration, g_quark_from_static_string("events_discarded"));
+               len_index = bt_struct_declaration_lookup_field_index(file_stream->parent.stream_packet_context->declaration, g_quark_from_string("events_discarded"));
                if (len_index >= 0) {
                        struct bt_definition *field;
 
@@ -1928,7 +1936,7 @@ begin:
                /* read packet_seq_num from header */
                len_index = bt_struct_declaration_lookup_field_index(
                                file_stream->parent.stream_packet_context->declaration,
-                               g_quark_from_static_string("packet_seq_num"));
+                               g_quark_from_string("packet_seq_num"));
                if (len_index >= 0) {
                        struct bt_definition *field;
 
@@ -2491,8 +2499,10 @@ struct bt_trace_descriptor *ctf_open_trace(const char *path, int flags,
 
        return &td->parent;
 error:
-       trace_debug_info_destroy(td);
-       g_free(td);
+       if (td) {
+               trace_debug_info_destroy(td);
+               g_free(td);
+       }
        return NULL;
 }
 
@@ -2846,7 +2856,7 @@ void __attribute__((constructor)) ctf_init(void)
 {
        int ret;
 
-       ctf_format.name = g_quark_from_static_string("ctf");
+       ctf_format.name = g_quark_from_string("ctf");
        ret = bt_register_format(&ctf_format);
        assert(!ret);
 }
This page took 0.026032 seconds and 4 git commands to generate.