Add empty plug-in hooks to prevent their elimination by the linker
[babeltrace.git] / formats / ctf-metadata / ctf-metadata.c
index 578e8da86a81b47179e2629b956780a16d623362..a6397ec0b18d7b5f11d526567c29469bccacdd3e 100644 (file)
@@ -54,6 +54,14 @@ struct bt_format ctf_metadata_format = {
        .close_trace = ctf_metadata_close_trace,
 };
 
+void bt_ctf_metadata_hook(void)
+{
+       /*
+        * Dummy function to prevent the linker from discarding this format as
+        * "unused" in static builds.
+        */
+}
+
 static
 int ctf_metadata_trace_pre_handler(struct bt_stream_pos *ppos,
                        struct bt_trace_descriptor *td)
@@ -95,6 +103,7 @@ struct bt_trace_descriptor *ctf_metadata_open_trace(const char *path, int flags,
                        goto error;
                pos->fp = fp;
                pos->parent.pre_trace_cb = ctf_metadata_trace_pre_handler;
+               pos->parent.trace = &pos->trace_descriptor;
                pos->print_names = 0;
                break;
        case O_RDONLY:
@@ -131,7 +140,7 @@ void __attribute__((constructor)) ctf_metadata_init(void)
 {
        int ret;
 
-       ctf_metadata_format.name = g_quark_from_static_string("ctf-metadata");
+       ctf_metadata_format.name = g_quark_from_string("ctf-metadata");
        ret = bt_register_format(&ctf_metadata_format);
        assert(!ret);
 }
This page took 0.026639 seconds and 4 git commands to generate.