From 9643611120f9bf174684cb0a06ec9ed418e3341e Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Mon, 23 Jan 2017 21:30:06 -0500 Subject: [PATCH] Remove bt_ctf_field_type_enumeration_get_mapping_name MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau --- formats/ctf/ir/field-types.c | 53 +++++++++++++------------ include/babeltrace/ctf-ir/field-types.h | 4 -- 2 files changed, 27 insertions(+), 30 deletions(-) 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) diff --git a/include/babeltrace/ctf-ir/field-types.h b/include/babeltrace/ctf-ir/field-types.h index 7ae3ae55..e9b5f253 100644 --- a/include/babeltrace/ctf-ir/field-types.h +++ b/include/babeltrace/ctf-ir/field-types.h @@ -1316,10 +1316,6 @@ struct bt_ctf_field_type *bt_ctf_field_type_enumeration_get_container_type( extern int bt_ctf_field_type_enumeration_get_mapping_count( struct bt_ctf_field_type *enum_field_type); -extern int bt_ctf_field_type_enumeration_get_mapping_name( - struct bt_ctf_field_type *enum_field_type, int index, - const char **name); - /** @brief Returns the signed mapping of the @enumft \p enum_field_type at index \p index. -- 2.34.1