1 #ifndef BABELTRACE_PLUGIN_CTF_FS_SINK_FS_SINK_CTF_META_H
2 #define BABELTRACE_PLUGIN_CTF_FS_SINK_FS_SINK_CTF_META_H
5 * Copyright 2018-2019 - Philippe Proulx <pproulx@efficios.com>
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
18 #include <babeltrace/babeltrace.h>
19 #include <babeltrace/common-internal.h>
20 #include <babeltrace/assert-internal.h>
21 #include <babeltrace/compat/uuid-internal.h>
28 enum fs_sink_ctf_field_class_type
{
29 FS_SINK_CTF_FIELD_CLASS_TYPE_INT
,
30 FS_SINK_CTF_FIELD_CLASS_TYPE_FLOAT
,
31 FS_SINK_CTF_FIELD_CLASS_TYPE_STRING
,
32 FS_SINK_CTF_FIELD_CLASS_TYPE_STRUCT
,
33 FS_SINK_CTF_FIELD_CLASS_TYPE_ARRAY
,
34 FS_SINK_CTF_FIELD_CLASS_TYPE_SEQUENCE
,
35 FS_SINK_CTF_FIELD_CLASS_TYPE_VARIANT
,
38 struct fs_sink_ctf_field_class
{
39 enum fs_sink_ctf_field_class_type type
;
42 const bt_field_class
*ir_fc
;
44 unsigned int alignment
;
46 /* Index of the field class within its own parent */
47 uint64_t index_in_parent
;
50 struct fs_sink_ctf_field_class_bit_array
{
51 struct fs_sink_ctf_field_class base
;
55 struct fs_sink_ctf_field_class_int
{
56 struct fs_sink_ctf_field_class_bit_array base
;
60 struct fs_sink_ctf_field_class_float
{
61 struct fs_sink_ctf_field_class_bit_array base
;
64 struct fs_sink_ctf_field_class_string
{
65 struct fs_sink_ctf_field_class base
;
68 struct fs_sink_ctf_named_field_class
{
72 struct fs_sink_ctf_field_class
*fc
;
75 struct fs_sink_ctf_field_class_struct
{
76 struct fs_sink_ctf_field_class base
;
78 /* Array of `struct fs_sink_ctf_named_field_class` */
82 struct fs_sink_ctf_field_class_variant
{
83 struct fs_sink_ctf_field_class base
;
87 /* Array of `struct fs_sink_ctf_named_field_class` */
91 struct fs_sink_ctf_field_class_array_base
{
92 struct fs_sink_ctf_field_class base
;
93 struct fs_sink_ctf_field_class
*elem_fc
;
96 struct fs_sink_ctf_field_class_array
{
97 struct fs_sink_ctf_field_class_array_base base
;
101 struct fs_sink_ctf_field_class_sequence
{
102 struct fs_sink_ctf_field_class_array_base base
;
104 bool length_is_before
;
107 struct fs_sink_ctf_stream_class
;
109 struct fs_sink_ctf_event_class
{
111 const bt_event_class
*ir_ec
;
114 struct fs_sink_ctf_stream_class
*sc
;
117 struct fs_sink_ctf_field_class
*spec_context_fc
;
120 struct fs_sink_ctf_field_class
*payload_fc
;
123 struct fs_sink_ctf_trace_class
;
125 struct fs_sink_ctf_stream_class
{
127 struct fs_sink_ctf_trace_class
*tc
;
130 const bt_stream_class
*ir_sc
;
133 const bt_clock_class
*default_clock_class
;
135 GString
*default_clock_class_name
;
138 struct fs_sink_ctf_field_class
*packet_context_fc
;
141 struct fs_sink_ctf_field_class
*event_common_context_fc
;
143 /* Array of `struct fs_sink_ctf_event_class *` (owned by this) */
144 GPtrArray
*event_classes
;
147 * `const bt_event_class *` (weak) ->
148 * `struct fs_sink_ctf_event_class *` (weak)
150 GHashTable
*event_classes_from_ir
;
153 struct fs_sink_ctf_trace_class
{
155 const bt_trace_class
*ir_tc
;
157 unsigned char uuid
[BABELTRACE_UUID_LEN
];
159 /* Array of `struct fs_sink_ctf_stream_class *` (owned by this) */
160 GPtrArray
*stream_classes
;
164 void fs_sink_ctf_field_class_destroy(struct fs_sink_ctf_field_class
*fc
);
167 void _fs_sink_ctf_field_class_init(struct fs_sink_ctf_field_class
*fc
,
168 enum fs_sink_ctf_field_class_type type
,
169 const bt_field_class
*ir_fc
, unsigned int alignment
,
170 uint64_t index_in_parent
)
175 fc
->alignment
= alignment
;
176 fc
->index_in_parent
= index_in_parent
;
180 void _fs_sink_ctf_field_class_bit_array_init(
181 struct fs_sink_ctf_field_class_bit_array
*fc
,
182 enum fs_sink_ctf_field_class_type type
,
183 const bt_field_class
*ir_fc
, unsigned int size
,
184 uint64_t index_in_parent
)
186 _fs_sink_ctf_field_class_init((void *) fc
, type
, ir_fc
,
187 size
% 8 == 0 ? 8 : 1, index_in_parent
);
192 void _fs_sink_ctf_field_class_int_init(struct fs_sink_ctf_field_class_int
*fc
,
193 enum fs_sink_ctf_field_class_type type
,
194 const bt_field_class
*ir_fc
, uint64_t index_in_parent
)
196 bt_field_class_type ir_fc_type
= bt_field_class_get_type(ir_fc
);
198 _fs_sink_ctf_field_class_bit_array_init((void *) fc
, type
, ir_fc
,
199 (unsigned int) bt_field_class_integer_get_field_value_range(
202 fc
->is_signed
= (ir_fc_type
== BT_FIELD_CLASS_TYPE_SIGNED_INTEGER
||
203 ir_fc_type
== BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION
);
207 void _fs_sink_ctf_named_field_class_init(
208 struct fs_sink_ctf_named_field_class
*named_fc
)
211 named_fc
->name
= g_string_new(NULL
);
212 BT_ASSERT(named_fc
->name
);
216 void _fs_sink_ctf_named_field_class_fini(
217 struct fs_sink_ctf_named_field_class
*named_fc
)
221 if (named_fc
->name
) {
222 g_string_free(named_fc
->name
, TRUE
);
223 named_fc
->name
= NULL
;
226 fs_sink_ctf_field_class_destroy(named_fc
->fc
);
231 struct fs_sink_ctf_field_class_int
*fs_sink_ctf_field_class_int_create(
232 const bt_field_class
*ir_fc
, uint64_t index_in_parent
)
234 struct fs_sink_ctf_field_class_int
*fc
=
235 g_new0(struct fs_sink_ctf_field_class_int
, 1);
238 _fs_sink_ctf_field_class_int_init(fc
, FS_SINK_CTF_FIELD_CLASS_TYPE_INT
,
239 ir_fc
, index_in_parent
);
244 struct fs_sink_ctf_field_class_float
*fs_sink_ctf_field_class_float_create(
245 const bt_field_class
*ir_fc
, uint64_t index_in_parent
)
247 struct fs_sink_ctf_field_class_float
*fc
=
248 g_new0(struct fs_sink_ctf_field_class_float
, 1);
251 _fs_sink_ctf_field_class_bit_array_init((void *) fc
,
252 FS_SINK_CTF_FIELD_CLASS_TYPE_FLOAT
,
253 ir_fc
, bt_field_class_real_is_single_precision(ir_fc
) ? 32 : 64,
259 struct fs_sink_ctf_field_class_string
*fs_sink_ctf_field_class_string_create(
260 const bt_field_class
*ir_fc
, uint64_t index_in_parent
)
262 struct fs_sink_ctf_field_class_string
*fc
=
263 g_new0(struct fs_sink_ctf_field_class_string
, 1);
266 _fs_sink_ctf_field_class_init((void *) fc
,
267 FS_SINK_CTF_FIELD_CLASS_TYPE_STRING
, ir_fc
,
273 struct fs_sink_ctf_field_class_struct
*fs_sink_ctf_field_class_struct_create_empty(
274 const bt_field_class
*ir_fc
, uint64_t index_in_parent
)
276 struct fs_sink_ctf_field_class_struct
*fc
=
277 g_new0(struct fs_sink_ctf_field_class_struct
, 1);
280 _fs_sink_ctf_field_class_init((void *) fc
,
281 FS_SINK_CTF_FIELD_CLASS_TYPE_STRUCT
, ir_fc
, 1, index_in_parent
);
282 fc
->members
= g_array_new(FALSE
, TRUE
,
283 sizeof(struct fs_sink_ctf_named_field_class
));
284 BT_ASSERT(fc
->members
);
289 struct fs_sink_ctf_field_class_variant
*fs_sink_ctf_field_class_variant_create_empty(
290 const bt_field_class
*ir_fc
, uint64_t index_in_parent
)
292 struct fs_sink_ctf_field_class_variant
*fc
=
293 g_new0(struct fs_sink_ctf_field_class_variant
, 1);
296 _fs_sink_ctf_field_class_init((void *) fc
,
297 FS_SINK_CTF_FIELD_CLASS_TYPE_VARIANT
, ir_fc
,
299 fc
->options
= g_array_new(FALSE
, TRUE
,
300 sizeof(struct fs_sink_ctf_named_field_class
));
301 BT_ASSERT(fc
->options
);
302 fc
->tag_ref
= g_string_new(NULL
);
303 BT_ASSERT(fc
->tag_ref
);
305 bt_field_class_variant_borrow_selector_field_path_const(ir_fc
) ==
311 struct fs_sink_ctf_field_class_array
*fs_sink_ctf_field_class_array_create_empty(
312 const bt_field_class
*ir_fc
, uint64_t index_in_parent
)
314 struct fs_sink_ctf_field_class_array
*fc
=
315 g_new0(struct fs_sink_ctf_field_class_array
, 1);
318 _fs_sink_ctf_field_class_init((void *) fc
,
319 FS_SINK_CTF_FIELD_CLASS_TYPE_ARRAY
, ir_fc
,
321 fc
->length
= bt_field_class_static_array_get_length(ir_fc
);
326 struct fs_sink_ctf_field_class_sequence
*fs_sink_ctf_field_class_sequence_create_empty(
327 const bt_field_class
*ir_fc
, uint64_t index_in_parent
)
329 struct fs_sink_ctf_field_class_sequence
*fc
=
330 g_new0(struct fs_sink_ctf_field_class_sequence
, 1);
333 _fs_sink_ctf_field_class_init((void *) fc
,
334 FS_SINK_CTF_FIELD_CLASS_TYPE_SEQUENCE
,
335 ir_fc
, 1, index_in_parent
);
336 fc
->length_ref
= g_string_new(NULL
);
337 BT_ASSERT(fc
->length_ref
);
338 fc
->length_is_before
=
339 bt_field_class_dynamic_array_borrow_length_field_path_const(ir_fc
) ==
345 struct fs_sink_ctf_named_field_class
*
346 fs_sink_ctf_field_class_struct_borrow_member_by_index(
347 struct fs_sink_ctf_field_class_struct
*fc
, uint64_t index
);
350 struct fs_sink_ctf_named_field_class
*
351 fs_sink_ctf_field_class_variant_borrow_option_by_index(
352 struct fs_sink_ctf_field_class_variant
*fc
, uint64_t index
);
355 void _fs_sink_ctf_field_class_fini(struct fs_sink_ctf_field_class
*fc
)
361 void _fs_sink_ctf_field_class_int_destroy(
362 struct fs_sink_ctf_field_class_int
*fc
)
365 _fs_sink_ctf_field_class_fini((void *) fc
);
370 void _fs_sink_ctf_field_class_float_destroy(
371 struct fs_sink_ctf_field_class_float
*fc
)
374 _fs_sink_ctf_field_class_fini((void *) fc
);
379 void _fs_sink_ctf_field_class_string_destroy(
380 struct fs_sink_ctf_field_class_string
*fc
)
383 _fs_sink_ctf_field_class_fini((void *) fc
);
388 void _fs_sink_ctf_field_class_struct_destroy(
389 struct fs_sink_ctf_field_class_struct
*fc
)
392 _fs_sink_ctf_field_class_fini((void *) fc
);
397 for (i
= 0; i
< fc
->members
->len
; i
++) {
398 struct fs_sink_ctf_named_field_class
*named_fc
=
399 fs_sink_ctf_field_class_struct_borrow_member_by_index(
402 _fs_sink_ctf_named_field_class_fini(named_fc
);
405 g_array_free(fc
->members
, TRUE
);
413 void _fs_sink_ctf_field_class_array_base_fini(
414 struct fs_sink_ctf_field_class_array_base
*fc
)
417 _fs_sink_ctf_field_class_fini((void *) fc
);
418 fs_sink_ctf_field_class_destroy(fc
->elem_fc
);
423 void _fs_sink_ctf_field_class_array_destroy(
424 struct fs_sink_ctf_field_class_array
*fc
)
427 _fs_sink_ctf_field_class_array_base_fini((void *) fc
);
432 void _fs_sink_ctf_field_class_sequence_destroy(
433 struct fs_sink_ctf_field_class_sequence
*fc
)
436 _fs_sink_ctf_field_class_array_base_fini((void *) fc
);
438 if (fc
->length_ref
) {
439 g_string_free(fc
->length_ref
, TRUE
);
440 fc
->length_ref
= NULL
;
447 void _fs_sink_ctf_field_class_variant_destroy(
448 struct fs_sink_ctf_field_class_variant
*fc
)
451 _fs_sink_ctf_field_class_fini((void *) fc
);
456 for (i
= 0; i
< fc
->options
->len
; i
++) {
457 struct fs_sink_ctf_named_field_class
*named_fc
=
458 fs_sink_ctf_field_class_variant_borrow_option_by_index(
461 _fs_sink_ctf_named_field_class_fini(named_fc
);
464 g_array_free(fc
->options
, TRUE
);
469 g_string_free(fc
->tag_ref
, TRUE
);
477 void fs_sink_ctf_field_class_destroy(struct fs_sink_ctf_field_class
*fc
)
484 case FS_SINK_CTF_FIELD_CLASS_TYPE_INT
:
485 _fs_sink_ctf_field_class_int_destroy((void *) fc
);
487 case FS_SINK_CTF_FIELD_CLASS_TYPE_FLOAT
:
488 _fs_sink_ctf_field_class_float_destroy((void *) fc
);
490 case FS_SINK_CTF_FIELD_CLASS_TYPE_STRING
:
491 _fs_sink_ctf_field_class_string_destroy((void *) fc
);
493 case FS_SINK_CTF_FIELD_CLASS_TYPE_STRUCT
:
494 _fs_sink_ctf_field_class_struct_destroy((void *) fc
);
496 case FS_SINK_CTF_FIELD_CLASS_TYPE_ARRAY
:
497 _fs_sink_ctf_field_class_array_destroy((void *) fc
);
499 case FS_SINK_CTF_FIELD_CLASS_TYPE_SEQUENCE
:
500 _fs_sink_ctf_field_class_sequence_destroy((void *) fc
);
502 case FS_SINK_CTF_FIELD_CLASS_TYPE_VARIANT
:
503 _fs_sink_ctf_field_class_variant_destroy((void *) fc
);
511 struct fs_sink_ctf_named_field_class
*
512 fs_sink_ctf_field_class_struct_borrow_member_by_index(
513 struct fs_sink_ctf_field_class_struct
*fc
, uint64_t index
)
516 BT_ASSERT(index
< fc
->members
->len
);
517 return &g_array_index(fc
->members
, struct fs_sink_ctf_named_field_class
,
522 struct fs_sink_ctf_named_field_class
*
523 fs_sink_ctf_field_class_struct_borrow_member_by_name(
524 struct fs_sink_ctf_field_class_struct
*fc
, const char *name
)
527 struct fs_sink_ctf_named_field_class
*ret_named_fc
= NULL
;
532 for (i
= 0; i
< fc
->members
->len
; i
++) {
533 struct fs_sink_ctf_named_field_class
*named_fc
=
534 fs_sink_ctf_field_class_struct_borrow_member_by_index(
537 if (strcmp(name
, named_fc
->name
->str
) == 0) {
538 ret_named_fc
= named_fc
;
548 struct fs_sink_ctf_field_class
*
549 fs_sink_ctf_field_class_struct_borrow_member_field_class_by_name(
550 struct fs_sink_ctf_field_class_struct
*struct_fc
, const char *name
)
552 struct fs_sink_ctf_named_field_class
*named_fc
= NULL
;
553 struct fs_sink_ctf_field_class
*fc
= NULL
;
559 named_fc
= fs_sink_ctf_field_class_struct_borrow_member_by_name(
572 struct fs_sink_ctf_field_class_int
*
573 fs_sink_ctf_field_class_struct_borrow_member_int_field_class_by_name(
574 struct fs_sink_ctf_field_class_struct
*struct_fc
,
577 struct fs_sink_ctf_field_class_int
*int_fc
= NULL
;
580 fs_sink_ctf_field_class_struct_borrow_member_field_class_by_name(
586 if (int_fc
->base
.base
.type
!= FS_SINK_CTF_FIELD_CLASS_TYPE_INT
) {
596 void fs_sink_ctf_field_class_struct_align_at_least(
597 struct fs_sink_ctf_field_class_struct
*fc
,
598 unsigned int alignment
)
600 if (alignment
> fc
->base
.alignment
) {
601 fc
->base
.alignment
= alignment
;
606 void fs_sink_ctf_field_class_struct_append_member(
607 struct fs_sink_ctf_field_class_struct
*fc
,
608 const char *name
, struct fs_sink_ctf_field_class
*member_fc
)
610 struct fs_sink_ctf_named_field_class
*named_fc
;
614 g_array_set_size(fc
->members
, fc
->members
->len
+ 1);
616 named_fc
= &g_array_index(fc
->members
,
617 struct fs_sink_ctf_named_field_class
, fc
->members
->len
- 1);
618 _fs_sink_ctf_named_field_class_init(named_fc
);
619 g_string_assign(named_fc
->name
, name
);
620 named_fc
->fc
= member_fc
;
621 fs_sink_ctf_field_class_struct_align_at_least(fc
, member_fc
->alignment
);
625 struct fs_sink_ctf_named_field_class
*
626 fs_sink_ctf_field_class_variant_borrow_option_by_index(
627 struct fs_sink_ctf_field_class_variant
*fc
, uint64_t index
)
630 BT_ASSERT(index
< fc
->options
->len
);
631 return &g_array_index(fc
->options
, struct fs_sink_ctf_named_field_class
,
636 struct fs_sink_ctf_named_field_class
*
637 fs_sink_ctf_field_class_variant_borrow_option_by_name(
638 struct fs_sink_ctf_field_class_variant
*fc
, const char *name
)
641 struct fs_sink_ctf_named_field_class
*ret_named_fc
= NULL
;
646 for (i
= 0; i
< fc
->options
->len
; i
++) {
647 struct fs_sink_ctf_named_field_class
*named_fc
=
648 fs_sink_ctf_field_class_variant_borrow_option_by_index(
651 if (strcmp(name
, named_fc
->name
->str
) == 0) {
652 ret_named_fc
= named_fc
;
662 void fs_sink_ctf_field_class_variant_append_option(
663 struct fs_sink_ctf_field_class_variant
*fc
,
664 const char *name
, struct fs_sink_ctf_field_class
*option_fc
)
666 struct fs_sink_ctf_named_field_class
*named_fc
;
670 g_array_set_size(fc
->options
, fc
->options
->len
+ 1);
672 named_fc
= &g_array_index(fc
->options
,
673 struct fs_sink_ctf_named_field_class
, fc
->options
->len
- 1);
674 _fs_sink_ctf_named_field_class_init(named_fc
);
675 g_string_assign(named_fc
->name
, name
);
676 named_fc
->fc
= option_fc
;
680 struct fs_sink_ctf_event_class
*fs_sink_ctf_event_class_create(
681 struct fs_sink_ctf_stream_class
*sc
,
682 const bt_event_class
*ir_ec
)
684 struct fs_sink_ctf_event_class
*ec
=
685 g_new0(struct fs_sink_ctf_event_class
, 1);
692 g_ptr_array_add(sc
->event_classes
, ec
);
693 g_hash_table_insert(sc
->event_classes_from_ir
, (gpointer
) ir_ec
, ec
);
698 void fs_sink_ctf_event_class_destroy(struct fs_sink_ctf_event_class
*ec
)
704 fs_sink_ctf_field_class_destroy(ec
->spec_context_fc
);
705 ec
->spec_context_fc
= NULL
;
706 fs_sink_ctf_field_class_destroy(ec
->payload_fc
);
707 ec
->payload_fc
= NULL
;
712 struct fs_sink_ctf_stream_class
*fs_sink_ctf_stream_class_create(
713 struct fs_sink_ctf_trace_class
*tc
,
714 const bt_stream_class
*ir_sc
)
716 struct fs_sink_ctf_stream_class
*sc
=
717 g_new0(struct fs_sink_ctf_stream_class
, 1);
724 sc
->default_clock_class
=
725 bt_stream_class_borrow_default_clock_class_const(ir_sc
);
726 sc
->default_clock_class_name
= g_string_new(NULL
);
727 BT_ASSERT(sc
->default_clock_class_name
);
728 sc
->event_classes
= g_ptr_array_new_with_free_func(
729 (GDestroyNotify
) fs_sink_ctf_event_class_destroy
);
730 BT_ASSERT(sc
->event_classes
);
731 sc
->event_classes_from_ir
= g_hash_table_new(g_direct_hash
,
733 BT_ASSERT(sc
->event_classes_from_ir
);
734 g_ptr_array_add(tc
->stream_classes
, sc
);
739 void fs_sink_ctf_stream_class_destroy(struct fs_sink_ctf_stream_class
*sc
)
745 if (sc
->default_clock_class_name
) {
746 g_string_free(sc
->default_clock_class_name
, TRUE
);
747 sc
->default_clock_class_name
= NULL
;
750 if (sc
->event_classes
) {
751 g_ptr_array_free(sc
->event_classes
, TRUE
);
752 sc
->event_classes
= NULL
;
755 if (sc
->event_classes_from_ir
) {
756 g_hash_table_destroy(sc
->event_classes_from_ir
);
757 sc
->event_classes_from_ir
= NULL
;
760 fs_sink_ctf_field_class_destroy(sc
->packet_context_fc
);
761 sc
->packet_context_fc
= NULL
;
762 fs_sink_ctf_field_class_destroy(sc
->event_common_context_fc
);
763 sc
->event_common_context_fc
= NULL
;
768 void fs_sink_ctf_stream_class_append_event_class(
769 struct fs_sink_ctf_stream_class
*sc
,
770 struct fs_sink_ctf_event_class
*ec
)
772 g_ptr_array_add(sc
->event_classes
, ec
);
776 void fs_sink_ctf_trace_class_destroy(struct fs_sink_ctf_trace_class
*tc
)
782 if (tc
->stream_classes
) {
783 g_ptr_array_free(tc
->stream_classes
, TRUE
);
784 tc
->stream_classes
= NULL
;
791 struct fs_sink_ctf_trace_class
*fs_sink_ctf_trace_class_create(
792 const bt_trace_class
*ir_tc
)
794 struct fs_sink_ctf_trace_class
*tc
=
795 g_new0(struct fs_sink_ctf_trace_class
, 1);
799 if (bt_uuid_generate(tc
->uuid
)) {
800 fs_sink_ctf_trace_class_destroy(tc
);
806 tc
->stream_classes
= g_ptr_array_new_with_free_func(
807 (GDestroyNotify
) fs_sink_ctf_stream_class_destroy
);
808 BT_ASSERT(tc
->stream_classes
);
815 bool fs_sink_ctf_ist_valid_identifier(const char *name
)
819 bool ist_valid
= true;
820 static const char *reserved_keywords
[] = {
851 /* Make sure the name is not a reserved keyword */
852 for (i
= 0; i
< sizeof(reserved_keywords
) / sizeof(*reserved_keywords
);
854 if (strcmp(name
, reserved_keywords
[i
]) == 0) {
860 /* Make sure the name is not an empty string */
861 if (strlen(name
) == 0) {
866 /* Make sure the name starts with a letter or `_` */
867 if (!isalpha(name
[0]) && name
[0] != '_') {
872 /* Make sure the name only contains letters, digits, and `_` */
873 for (at
= name
; *at
!= '\0'; at
++) {
874 if (!isalnum(*at
) && *at
!= '_') {
885 int fs_sink_ctf_protect_name(GString
*name
)
889 if (!fs_sink_ctf_ist_valid_identifier(name
->str
)) {
894 /* Prepend `_` to protect it */
895 g_string_prepend_c(name
, '_');
901 #endif /* BABELTRACE_PLUGIN_CTF_FS_SINK_FS_SINK_CTF_META_H */