58
58
int opt_clock_force_correlate;
61
struct declaration *ctf_type_specifier_list_visit(FILE *fd,
61
struct bt_declaration *ctf_type_specifier_list_visit(FILE *fd,
62
62
int depth, struct ctf_node *type_specifier_list,
63
63
struct declaration_scope *declaration_scope,
64
64
struct ctf_trace *trace);
414
struct declaration *ctf_type_declarator_visit(FILE *fd, int depth,
414
struct bt_declaration *ctf_type_declarator_visit(FILE *fd, int depth,
415
415
struct ctf_node *type_specifier_list,
416
416
GQuark *field_name,
417
417
struct ctf_node *node_type_declarator,
418
418
struct declaration_scope *declaration_scope,
419
struct declaration *nested_declaration,
419
struct bt_declaration *nested_declaration,
420
420
struct ctf_trace *trace)
446
446
alias_q = create_typealias_identifier(fd, depth,
447
447
type_specifier_list, node_type_declarator);
448
nested_declaration = lookup_declaration(alias_q, declaration_scope);
448
nested_declaration = bt_lookup_declaration(alias_q, declaration_scope);
449
449
if (!nested_declaration) {
450
450
fprintf(fd, "[error] %s: cannot find typealias \"%s\".\n", __func__, g_quark_to_string(alias_q));
460
460
* integer declaration to modify it. There could be other references to
463
integer_declaration = integer_declaration_new(integer_declaration->len,
463
integer_declaration = bt_integer_declaration_new(integer_declaration->len,
464
464
integer_declaration->byte_order, integer_declaration->signedness,
465
465
integer_declaration->p.alignment, 16, integer_declaration->encoding,
466
466
integer_declaration->clock);
511
511
len = first->u.unary_expression.u.unsigned_constant;
512
array_declaration = array_declaration_new(len, nested_declaration,
512
array_declaration = bt_array_declaration_new(len, nested_declaration,
513
513
declaration_scope);
515
515
if (!array_declaration) {
516
516
fprintf(fd, "[error] %s: cannot create array declaration.\n", __func__);
519
declaration_unref(nested_declaration);
519
bt_declaration_unref(nested_declaration);
520
520
declaration = &array_declaration->p;
526
526
char *length_name = concatenate_unary_strings(&node_type_declarator->u.type_declarator.u.nested.length);
527
527
struct declaration_sequence *sequence_declaration;
529
sequence_declaration = sequence_declaration_new(length_name, nested_declaration, declaration_scope);
529
sequence_declaration = bt_sequence_declaration_new(length_name, nested_declaration, declaration_scope);
530
530
if (!sequence_declaration) {
531
531
fprintf(fd, "[error] %s: cannot create sequence declaration.\n", __func__);
532
532
g_free(length_name);
535
declaration_unref(nested_declaration);
535
bt_declaration_unref(nested_declaration);
536
536
declaration = &sequence_declaration->p;
537
537
g_free(length_name);
562
562
GQuark field_name;
564
564
bt_list_for_each_entry(iter, type_declarators, siblings) {
565
struct declaration *field_declaration;
565
struct bt_declaration *field_declaration;
567
567
field_declaration = ctf_type_declarator_visit(fd, depth,
568
568
type_specifier_list,
577
577
/* Check if field with same name already exists */
578
if (struct_declaration_lookup_field_index(struct_declaration, field_name) >= 0) {
578
if (bt_struct_declaration_lookup_field_index(struct_declaration, field_name) >= 0) {
579
579
fprintf(fd, "[error] %s: duplicate field %s in struct\n", __func__, g_quark_to_string(field_name));
583
struct_declaration_add_field(struct_declaration,
583
bt_struct_declaration_add_field(struct_declaration,
584
584
g_quark_to_string(field_name),
585
585
field_declaration);
586
declaration_unref(field_declaration);
586
bt_declaration_unref(field_declaration);
600
600
GQuark field_name;
602
602
bt_list_for_each_entry(iter, type_declarators, siblings) {
603
struct declaration *field_declaration;
603
struct bt_declaration *field_declaration;
605
605
field_declaration = ctf_type_declarator_visit(fd, depth,
606
606
type_specifier_list,
615
if (untagged_variant_declaration_get_field_from_tag(untagged_variant_declaration, field_name) != NULL) {
615
if (bt_untagged_variant_declaration_get_field_from_tag(untagged_variant_declaration, field_name) != NULL) {
616
616
fprintf(fd, "[error] %s: duplicate field %s in variant\n", __func__, g_quark_to_string(field_name));
620
untagged_variant_declaration_add_field(untagged_variant_declaration,
620
bt_untagged_variant_declaration_add_field(untagged_variant_declaration,
621
621
g_quark_to_string(field_name),
622
622
field_declaration);
623
declaration_unref(field_declaration);
623
bt_declaration_unref(field_declaration);
635
635
GQuark identifier;
637
637
bt_list_for_each_entry(iter, type_declarators, siblings) {
638
struct declaration *type_declaration;
638
struct bt_declaration *type_declaration;
641
641
type_declaration = ctf_type_declarator_visit(fd, depth,
653
653
if (type_declaration->id == CTF_TYPE_UNTAGGED_VARIANT) {
654
654
fprintf(fd, "[error] %s: typedef of untagged variant is not permitted.\n", __func__);
655
declaration_unref(type_declaration);
655
bt_declaration_unref(type_declaration);
658
ret = register_declaration(identifier, type_declaration, scope);
658
ret = bt_register_declaration(identifier, type_declaration, scope);
660
660
type_declaration->declaration_free(type_declaration);
663
declaration_unref(type_declaration);
663
bt_declaration_unref(type_declaration);
703
703
if (type_declaration->id == CTF_TYPE_UNTAGGED_VARIANT) {
704
704
fprintf(fd, "[error] %s: typedef of untagged variant is not permitted.\n", __func__);
705
declaration_unref(type_declaration);
705
bt_declaration_unref(type_declaration);
722
722
struct ctf_node, siblings);
723
723
alias_q = create_typealias_identifier(fd, depth,
724
724
alias->u.typealias_alias.type_specifier_list, node);
725
err = register_declaration(alias_q, type_declaration, scope);
725
err = bt_register_declaration(alias_q, type_declaration, scope);
728
declaration_unref(type_declaration);
728
bt_declaration_unref(type_declaration);
745
745
switch (iter->type) {
746
746
case NODE_TYPEDEF:
747
/* For each declarator, declare type and add type to struct declaration scope */
747
/* For each declarator, declare type and add type to struct bt_declaration scope */
748
748
ret = ctf_typedef_visit(fd, depth,
749
749
struct_declaration->scope,
750
750
iter->u._typedef.type_specifier_list,
755
755
case NODE_TYPEALIAS:
756
/* Declare type with declarator and add type to struct declaration scope */
756
/* Declare type with declarator and add type to struct bt_declaration scope */
757
757
ret = ctf_typealias_visit(fd, depth,
758
758
struct_declaration->scope,
759
759
iter->u.typealias.target,
826
struct declaration *ctf_declaration_struct_visit(FILE *fd,
826
struct bt_declaration *ctf_declaration_struct_visit(FILE *fd,
827
827
int depth, const char *name, struct bt_list_head *declaration_list,
828
828
int has_body, struct bt_list_head *min_align,
829
829
struct declaration_scope *declaration_scope,
842
842
struct_declaration =
843
lookup_struct_declaration(g_quark_from_string(name),
843
bt_lookup_struct_declaration(g_quark_from_string(name),
844
844
declaration_scope);
845
declaration_ref(&struct_declaration->p);
845
bt_declaration_ref(&struct_declaration->p);
846
846
return &struct_declaration->p;
848
848
uint64_t min_align_value = 0;
850
850
/* For unnamed struct, create type */
851
851
/* For named struct (with body), create type and add to declaration scope */
853
if (lookup_struct_declaration(g_quark_from_string(name),
853
if (bt_lookup_struct_declaration(g_quark_from_string(name),
854
854
declaration_scope)) {
856
856
fprintf(fd, "[error] %s: struct %s already declared in scope\n", __func__, name);
870
struct_declaration = struct_declaration_new(declaration_scope,
870
struct_declaration = bt_struct_declaration_new(declaration_scope,
871
871
min_align_value);
872
872
bt_list_for_each_entry(iter, declaration_list, siblings) {
897
struct declaration *ctf_declaration_variant_visit(FILE *fd,
897
struct bt_declaration *ctf_declaration_variant_visit(FILE *fd,
898
898
int depth, const char *name, const char *choice,
899
899
struct bt_list_head *declaration_list,
900
900
int has_body, struct declaration_scope *declaration_scope,
914
914
untagged_variant_declaration =
915
lookup_variant_declaration(g_quark_from_string(name),
915
bt_lookup_variant_declaration(g_quark_from_string(name),
916
916
declaration_scope);
917
declaration_ref(&untagged_variant_declaration->p);
917
bt_declaration_ref(&untagged_variant_declaration->p);
919
919
/* For unnamed variant, create type */
920
920
/* For named variant (with body), create type and add to declaration scope */
922
if (lookup_variant_declaration(g_quark_from_string(name),
922
if (bt_lookup_variant_declaration(g_quark_from_string(name),
923
923
declaration_scope)) {
925
925
fprintf(fd, "[error] %s: variant %s already declared in scope\n", __func__, name);
929
untagged_variant_declaration = untagged_variant_declaration_new(declaration_scope);
929
untagged_variant_declaration = bt_untagged_bt_variant_declaration_new(declaration_scope);
930
930
bt_list_for_each_entry(iter, declaration_list, siblings) {
941
ret = register_variant_declaration(g_quark_from_string(name),
941
ret = bt_register_variant_declaration(g_quark_from_string(name),
942
942
untagged_variant_declaration,
943
943
declaration_scope);
952
952
return &untagged_variant_declaration->p;
954
variant_declaration = variant_declaration_new(untagged_variant_declaration, choice);
954
variant_declaration = bt_variant_declaration_new(untagged_variant_declaration, choice);
955
955
if (!variant_declaration)
957
declaration_unref(&untagged_variant_declaration->p);
957
bt_declaration_unref(&untagged_variant_declaration->p);
958
958
return &variant_declaration->p;
1007
1007
if (nr_vals <= 1)
1009
1009
last->u.s = end + 1;
1010
enum_signed_insert(enum_declaration, start, end, q);
1010
bt_enum_signed_insert(enum_declaration, start, end, q);
1012
1012
uint64_t start, end;
1013
1013
int nr_vals = 0;
1047
1047
if (nr_vals <= 1)
1049
1049
last->u.u = end + 1;
1050
enum_unsigned_insert(enum_declaration, start, end, q);
1050
bt_enum_unsigned_insert(enum_declaration, start, end, q);
1056
struct declaration *ctf_declaration_enum_visit(FILE *fd, int depth,
1056
struct bt_declaration *ctf_declaration_enum_visit(FILE *fd, int depth,
1057
1057
const char *name,
1058
1058
struct ctf_node *container_type,
1059
1059
struct bt_list_head *enumerator_list,
1061
1061
struct declaration_scope *declaration_scope,
1062
1062
struct ctf_trace *trace)
1064
struct declaration *declaration;
1064
struct bt_declaration *declaration;
1065
1065
struct declaration_enum *enum_declaration;
1066
1066
struct declaration_integer *integer_declaration;
1067
1067
struct last_enum_value last_value;
1076
1076
if (!has_body) {
1078
1078
enum_declaration =
1079
lookup_enum_declaration(g_quark_from_string(name),
1079
bt_lookup_enum_declaration(g_quark_from_string(name),
1080
1080
declaration_scope);
1081
declaration_ref(&enum_declaration->p);
1081
bt_declaration_ref(&enum_declaration->p);
1082
1082
return &enum_declaration->p;
1084
1084
/* For unnamed enum, create type */
1085
1085
/* For named enum (with body), create type and add to declaration scope */
1087
if (lookup_enum_declaration(g_quark_from_string(name),
1087
if (bt_lookup_enum_declaration(g_quark_from_string(name),
1088
1088
declaration_scope)) {
1090
1090
fprintf(fd, "[error] %s: enum %s already declared in scope\n", __func__, name);
1094
1094
if (!container_type) {
1095
declaration = lookup_declaration(g_quark_from_static_string("int"),
1095
declaration = bt_lookup_declaration(g_quark_from_static_string("int"),
1096
1096
declaration_scope);
1097
1097
if (!declaration) {
1098
1098
fprintf(fd, "[error] %s: \"int\" type declaration missing for enumeration\n", __func__);
1116
1116
integer_declaration = container_of(declaration, struct declaration_integer, p);
1117
enum_declaration = enum_declaration_new(integer_declaration);
1118
declaration_unref(&integer_declaration->p); /* leave ref to enum */
1117
enum_declaration = bt_enum_declaration_new(integer_declaration);
1118
bt_declaration_unref(&integer_declaration->p); /* leave ref to enum */
1119
1119
if (enum_declaration->integer_declaration->signedness) {
1120
1120
last_value.u.s = 0;
1135
ret = register_enum_declaration(g_quark_from_string(name),
1135
ret = bt_register_enum_declaration(g_quark_from_string(name),
1136
1136
enum_declaration,
1137
1137
declaration_scope);
1139
declaration_unref(&enum_declaration->p);
1139
bt_declaration_unref(&enum_declaration->p);
1141
1141
return &enum_declaration->p;
1149
struct declaration *ctf_declaration_type_specifier_visit(FILE *fd, int depth,
1149
struct bt_declaration *ctf_declaration_type_specifier_visit(FILE *fd, int depth,
1150
1150
struct ctf_node *type_specifier_list,
1151
1151
struct declaration_scope *declaration_scope)
1154
struct declaration *declaration;
1154
struct bt_declaration *declaration;
1163
1163
str_c = g_string_free(str, FALSE);
1164
1164
id_q = g_quark_from_string(str_c);
1166
declaration = lookup_declaration(id_q, declaration_scope);
1167
declaration_ref(declaration);
1166
declaration = bt_lookup_declaration(id_q, declaration_scope);
1167
bt_declaration_ref(declaration);
1168
1168
return declaration;
1228
1228
else if (!strcmp(unary_expression->u.unary_expression.u.string, "le"))
1229
1229
byte_order = LITTLE_ENDIAN;
1231
fprintf(fd, "[error] %s: unexpected string \"%s\". Should be \"native\", \"network\", \"be\" or \"le\".\n",
1231
fprintf(fd, "[error] %s: unexpected string \"%s\". Should be \"be\" or \"le\".\n",
1232
1232
__func__, unary_expression->u.unary_expression.u.string);
1233
1233
return -EINVAL;
1266
struct declaration *ctf_declaration_integer_visit(FILE *fd, int depth,
1266
struct bt_declaration *ctf_declaration_integer_visit(FILE *fd, int depth,
1267
1267
struct bt_list_head *expressions,
1268
1268
struct ctf_trace *trace)
1442
1442
alignment = CHAR_BIT;
1445
integer_declaration = integer_declaration_new(size,
1445
integer_declaration = bt_integer_declaration_new(size,
1446
1446
byte_order, signedness, alignment,
1447
1447
base, encoding, clock);
1448
1448
return &integer_declaration->p;
1452
struct declaration *ctf_declaration_floating_point_visit(FILE *fd, int depth,
1452
struct bt_declaration *ctf_declaration_floating_point_visit(FILE *fd, int depth,
1453
1453
struct bt_list_head *expressions,
1454
1454
struct ctf_trace *trace)
1522
1522
alignment = CHAR_BIT;
1525
float_declaration = float_declaration_new(mant_dig, exp_dig,
1525
float_declaration = bt_float_declaration_new(mant_dig, exp_dig,
1526
1526
byte_order, alignment);
1527
1527
return &float_declaration->p;
1531
struct declaration *ctf_declaration_string_visit(FILE *fd, int depth,
1531
struct bt_declaration *ctf_declaration_string_visit(FILE *fd, int depth,
1532
1532
struct bt_list_head *expressions,
1533
1533
struct ctf_trace *trace)
1559
1559
if (encoding_c && !strcmp(encoding_c, "ASCII"))
1560
1560
encoding = CTF_STRING_ASCII;
1561
string_declaration = string_declaration_new(encoding);
1561
string_declaration = bt_string_declaration_new(encoding);
1562
1562
return &string_declaration->p;
1567
struct declaration *ctf_type_specifier_list_visit(FILE *fd,
1567
struct bt_declaration *ctf_type_specifier_list_visit(FILE *fd,
1568
1568
int depth, struct ctf_node *type_specifier_list,
1569
1569
struct declaration_scope *declaration_scope,
1570
1570
struct ctf_trace *trace)
1716
1716
CTF_EVENT_SET_FIELD(event, stream_id);
1717
1717
} else if (!strcmp(left, "context")) {
1718
struct declaration *declaration;
1718
struct bt_declaration *declaration;
1720
1720
if (event->context_decl) {
1721
1721
fprintf(fd, "[error] %s: context already declared in event declaration\n", __func__);
1737
1737
event->context_decl = container_of(declaration, struct declaration_struct, p);
1738
1738
} else if (!strcmp(left, "fields")) {
1739
struct declaration *declaration;
1739
struct bt_declaration *declaration;
1741
1741
if (event->fields_decl) {
1742
1742
fprintf(fd, "[error] %s: fields already declared in event declaration\n", __func__);
1817
1817
event_decl = g_new0(struct bt_ctf_event_decl, 1);
1818
1818
event = &event_decl->parent;
1819
event->declaration_scope = new_declaration_scope(parent_declaration_scope);
1819
event->declaration_scope = bt_new_declaration_scope(parent_declaration_scope);
1820
1820
event->loglevel = -1;
1821
1821
bt_list_for_each_entry(iter, &node->u.event.declaration_list, siblings) {
1822
1822
ret = ctf_event_declaration_visit(fd, depth + 1, iter, event, trace);
1866
1866
if (event->fields_decl)
1867
declaration_unref(&event->fields_decl->p);
1867
bt_declaration_unref(&event->fields_decl->p);
1868
1868
if (event->context_decl)
1869
declaration_unref(&event->context_decl->p);
1870
free_declaration_scope(event->declaration_scope);
1869
bt_declaration_unref(&event->context_decl->p);
1870
bt_free_declaration_scope(event->declaration_scope);
1871
1871
g_free(event_decl);
1916
1916
CTF_STREAM_SET_FIELD(stream, stream_id);
1917
1917
} else if (!strcmp(left, "event.header")) {
1918
struct declaration *declaration;
1918
struct bt_declaration *declaration;
1920
1920
if (stream->event_header_decl) {
1921
1921
fprintf(fd, "[error] %s: event.header already declared in stream declaration\n", __func__);
1937
1937
stream->event_header_decl = container_of(declaration, struct declaration_struct, p);
1938
1938
} else if (!strcmp(left, "event.context")) {
1939
struct declaration *declaration;
1939
struct bt_declaration *declaration;
1941
1941
if (stream->event_context_decl) {
1942
1942
fprintf(fd, "[error] %s: event.context already declared in stream declaration\n", __func__);
1958
1958
stream->event_context_decl = container_of(declaration, struct declaration_struct, p);
1959
1959
} else if (!strcmp(left, "packet.context")) {
1960
struct declaration *declaration;
1960
struct bt_declaration *declaration;
1962
1962
if (stream->packet_context_decl) {
1963
1963
fprintf(fd, "[error] %s: packet.context already declared in stream declaration\n", __func__);
2003
2003
struct ctf_stream_declaration *stream;
2005
2005
stream = g_new0(struct ctf_stream_declaration, 1);
2006
stream->declaration_scope = new_declaration_scope(parent_declaration_scope);
2006
stream->declaration_scope = bt_new_declaration_scope(parent_declaration_scope);
2007
2007
stream->events_by_id = g_ptr_array_new();
2008
2008
stream->event_quark_to_id = g_hash_table_new(g_direct_hash, g_direct_equal);
2009
2009
stream->streams = g_ptr_array_new();
2017
2017
if (CTF_STREAM_FIELD_IS_SET(stream, stream_id)) {
2018
2018
/* check that packet header has stream_id field. */
2019
2019
if (!trace->packet_header_decl
2020
|| struct_declaration_lookup_field_index(trace->packet_header_decl, g_quark_from_static_string("stream_id")) < 0) {
2020
|| bt_struct_declaration_lookup_field_index(trace->packet_header_decl, g_quark_from_static_string("stream_id")) < 0) {
2022
2022
fprintf(fd, "[error] %s: missing stream_id field in packet header declaration, but stream_id attribute is declared for stream.\n", __func__);
2042
2042
if (stream->event_header_decl)
2043
declaration_unref(&stream->event_header_decl->p);
2043
bt_declaration_unref(&stream->event_header_decl->p);
2044
2044
if (stream->event_context_decl)
2045
declaration_unref(&stream->event_context_decl->p);
2045
bt_declaration_unref(&stream->event_context_decl->p);
2046
2046
if (stream->packet_context_decl)
2047
declaration_unref(&stream->packet_context_decl->p);
2047
bt_declaration_unref(&stream->packet_context_decl->p);
2048
2048
g_ptr_array_free(stream->streams, TRUE);
2049
2049
g_ptr_array_free(stream->events_by_id, TRUE);
2050
2050
g_hash_table_destroy(stream->event_quark_to_id);
2051
free_declaration_scope(stream->declaration_scope);
2051
bt_free_declaration_scope(stream->declaration_scope);
2052
2052
g_free(stream);
2156
2156
CTF_TRACE_SET_FIELD(trace, byte_order);
2157
2157
} else if (!strcmp(left, "packet.header")) {
2158
struct declaration *declaration;
2158
struct bt_declaration *declaration;
2160
2160
if (trace->packet_header_decl) {
2161
2161
fprintf(fd, "[error] %s: packet.header already declared in trace declaration\n", __func__);
2200
2200
if (trace->declaration_scope)
2201
2201
return -EEXIST;
2202
trace->declaration_scope = new_declaration_scope(trace->root_declaration_scope);
2202
trace->declaration_scope = bt_new_declaration_scope(trace->root_declaration_scope);
2203
2203
trace->streams = g_ptr_array_new();
2204
2204
trace->event_declarations = g_ptr_array_new();
2205
2205
bt_list_for_each_entry(iter, &node->u.trace.declaration_list, siblings) {
2226
2226
if (!CTF_TRACE_FIELD_IS_SET(trace, byte_order)) {
2227
2227
/* check that the packet header contains a "magic" field */
2228
2228
if (!trace->packet_header_decl
2229
|| struct_declaration_lookup_field_index(trace->packet_header_decl, g_quark_from_static_string("magic")) < 0) {
2229
|| bt_struct_declaration_lookup_field_index(trace->packet_header_decl, g_quark_from_static_string("magic")) < 0) {
2231
2231
fprintf(fd, "[error] %s: missing both byte_order and packet header magic number in trace declaration\n", __func__);
2238
2238
if (trace->packet_header_decl) {
2239
declaration_unref(&trace->packet_header_decl->p);
2239
bt_declaration_unref(&trace->packet_header_decl->p);
2240
2240
trace->packet_header_decl = NULL;
2242
2242
g_ptr_array_free(trace->streams, TRUE);
2243
2243
g_ptr_array_free(trace->event_declarations, TRUE);
2244
free_declaration_scope(trace->declaration_scope);
2244
bt_free_declaration_scope(trace->declaration_scope);
2245
2245
trace->declaration_scope = NULL;
2398
2398
if (opt_clock_force_correlate) {
2400
2400
* User requested to forcibly correlate the clock
2401
* sources, even if we have no correlatation
2401
* sources, even if we have no correlation
2404
2404
if (!clock->absolute) {
2868
2868
struct ctf_node *iter;
2869
2869
int env_clock_done = 0;
2871
printf_verbose("CTF visitor: metadata construction... ");
2871
printf_verbose("CTF visitor: metadata construction...\n");
2872
2872
trace->byte_order = byte_order;
2873
2873
trace->clocks = g_hash_table_new_full(g_direct_hash, g_direct_equal,
2874
2874
NULL, clock_free);
2910
2910
bt_list_for_each_entry(iter, &node->u.root.trace, siblings) {
2911
2911
ret = ctf_trace_visit(fd, depth + 1, iter, trace);
2912
2912
if (ret == -EINTR) {
2913
free_declaration_scope(trace->root_declaration_scope);
2913
bt_free_declaration_scope(trace->root_declaration_scope);
2915
2915
* Need to restart creation of type
2916
2916
* definitions, aliases and
3006
3006
if (&event->event_fields->p)
3007
definition_unref(&event->event_fields->p);
3007
bt_definition_unref(&event->event_fields->p);
3008
3008
if (&event->event_context->p)
3009
definition_unref(&event->event_context->p);
3009
bt_definition_unref(&event->event_context->p);
3012
3012
if (&stream_def->trace_packet_header->p)
3013
definition_unref(&stream_def->trace_packet_header->p);
3013
bt_definition_unref(&stream_def->trace_packet_header->p);
3014
3014
if (&stream_def->stream_event_header->p)
3015
definition_unref(&stream_def->stream_event_header->p);
3015
bt_definition_unref(&stream_def->stream_event_header->p);
3016
3016
if (&stream_def->stream_packet_context->p)
3017
definition_unref(&stream_def->stream_packet_context->p);
3017
bt_definition_unref(&stream_def->stream_packet_context->p);
3018
3018
if (&stream_def->stream_event_context->p)
3019
definition_unref(&stream_def->stream_event_context->p);
3019
bt_definition_unref(&stream_def->stream_event_context->p);
3020
3020
g_ptr_array_free(stream_def->events_by_id, TRUE);
3021
3021
g_free(stream_def);
3023
3023
if (stream->event_header_decl)
3024
declaration_unref(&stream->event_header_decl->p);
3024
bt_declaration_unref(&stream->event_header_decl->p);
3025
3025
if (stream->event_context_decl)
3026
declaration_unref(&stream->event_context_decl->p);
3026
bt_declaration_unref(&stream->event_context_decl->p);
3027
3027
if (stream->packet_context_decl)
3028
declaration_unref(&stream->packet_context_decl->p);
3028
bt_declaration_unref(&stream->packet_context_decl->p);
3029
3029
g_ptr_array_free(stream->streams, TRUE);
3030
3030
g_ptr_array_free(stream->events_by_id, TRUE);
3031
3031
g_hash_table_destroy(stream->event_quark_to_id);
3032
free_declaration_scope(stream->declaration_scope);
3032
bt_free_declaration_scope(stream->declaration_scope);
3033
3033
g_free(stream);
3035
3035
g_ptr_array_free(trace->streams, TRUE);
3057
3057
event = &event_decl->parent;
3058
3058
if (event->fields_decl)
3059
declaration_unref(&event->fields_decl->p);
3059
bt_declaration_unref(&event->fields_decl->p);
3060
3060
if (event->context_decl)
3061
declaration_unref(&event->context_decl->p);
3062
free_declaration_scope(event->declaration_scope);
3061
bt_declaration_unref(&event->context_decl->p);
3062
bt_free_declaration_scope(event->declaration_scope);
3066
3066
g_ptr_array_free(trace->event_declarations, TRUE);
3068
3068
if (trace->packet_header_decl)
3069
declaration_unref(&trace->packet_header_decl->p);
3069
bt_declaration_unref(&trace->packet_header_decl->p);
3071
free_declaration_scope(trace->root_declaration_scope);
3072
free_declaration_scope(trace->declaration_scope);
3071
bt_free_declaration_scope(trace->root_declaration_scope);
3072
bt_free_declaration_scope(trace->declaration_scope);
3074
3074
g_hash_table_destroy(trace->callsites);
3075
3075
g_hash_table_destroy(trace->clocks);