Add empty plug-in hooks to prevent their elimination by the linker
[babeltrace.git] / formats / ctf / ctf.c
index c5d654c975f60a7ad74d3574eec377468ad185ce..d6d078f5386308ee26db4a58a2cd2d03681f896c 100644 (file)
@@ -157,6 +157,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
 uint64_t ctf_timestamp_begin(struct bt_trace_descriptor *descriptor,
                struct bt_trace_handle *handle, enum bt_clock_type type)
@@ -779,8 +787,6 @@ int ctf_init_pos(struct ctf_stream_pos *pos, struct bt_trace_descriptor *trace,
                pos->parent.rw_table = write_dispatch_table;
                pos->parent.event_cb = ctf_write_event;
                pos->parent.trace = trace;
-               if (fd >= 0)
-                       ctf_packet_seek(&pos->parent, 0, SEEK_SET);     /* position for write */
                break;
        default:
                assert(0);
@@ -2431,8 +2437,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;
 }
 
This page took 0.023142 seconds and 4 git commands to generate.