#include <babeltrace/context-internal.h>
#include <babeltrace/compat/uuid.h>
#include <babeltrace/endian.h>
-#include <babeltrace/trace-debuginfo.h>
+#include <babeltrace/trace-debug-info.h>
#include <babeltrace/ctf/ctf-index.h>
#include <inttypes.h>
#include <stdio.h>
.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,
* 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;
}
}
/* close to flush the buffer */
- ret = babeltrace_close_memstream(buf, &size, out);
+ ret = bt_close_memstream(buf, &size, out);
if (ret < 0) {
int closeret;
*fp = NULL;
return -ENOENT;
}
- *fp = babeltrace_fmemopen(*buf, buflen, "rb");
+ *fp = bt_fmemopen(*buf, buflen, "rb");
if (!*fp) {
perror("Metadata fmemopen");
return -errno;
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;
}
/* 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;
}
}
- 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;
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;
}
/* 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;
}
/* 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;
}
/* 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;
}
/* 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;
/* 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;
return &td->parent;
error:
- trace_debug_info_destroy(td);
- g_free(td);
+ if (td) {
+ trace_debug_info_destroy(td);
+ g_free(td);
+ }
return NULL;
}
{
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);
}