X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=formats%2Fctf%2Fir%2Ffield-types.c;fp=formats%2Fctf%2Fir%2Ffield-types.c;h=9e06840d4bda7dedfb6da2b2bf84609fc84cb861;hp=043df078464f5eb41d3bcec5b4f367c42b4546d7;hb=9643611120f9bf174684cb0a06ec9ed418e3341e;hpb=e0f15669bbfe5c29244ba6e0eb9f1e81f26e5244 diff --git a/formats/ctf/ir/field-types.c b/formats/ctf/ir/field-types.c index 043df078..9e06840d 100644 --- a/formats/ctf/ir/field-types.c +++ b/formats/ctf/ir/field-types.c @@ -632,6 +632,33 @@ bool bt_ctf_field_type_enumeration_has_overlapping_ranges( return enumeration_type->has_overlapping_ranges; } +static +int bt_ctf_field_type_enumeration_get_mapping_name( + struct bt_ctf_field_type *enum_field_type, + int index, + const char **mapping_name) +{ + int ret = 0; + struct enumeration_mapping *mapping; + + if (!enum_field_type || index < 0) { + ret = -1; + goto end; + } + + mapping = get_enumeration_mapping(enum_field_type, index); + if (!mapping) { + ret = -1; + goto end; + } + + if (mapping_name) { + *mapping_name = g_quark_to_string(mapping->string); + } +end: + return ret; +} + static int bt_ctf_field_type_variant_validate(struct bt_ctf_field_type *type) { @@ -1119,32 +1146,6 @@ error: return NULL; } -int bt_ctf_field_type_enumeration_get_mapping_name( - struct bt_ctf_field_type *enum_field_type, - int index, - const char **mapping_name) -{ - int ret = 0; - struct enumeration_mapping *mapping; - - if (!enum_field_type || index < 0) { - ret = -1; - goto end; - } - - mapping = get_enumeration_mapping(enum_field_type, index); - if (!mapping) { - ret = -1; - goto end; - } - - if (mapping_name) { - *mapping_name = g_quark_to_string(mapping->string); - } -end: - return ret; -} - int bt_ctf_field_type_enumeration_mapping_iterator_get_name( struct bt_ctf_field_type_enumeration_mapping_iterator *iter, const char **mapping_name)