From 6fa8d37b48e385c76a16e70dbefa36ef474ef142 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Tue, 16 May 2017 17:35:42 -0400 Subject: [PATCH] Fix: g_quark_try_string() is usually not a WARN trigger MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- lib/ctf-ir/field-types.c | 39 ++++++++++++++++++++++++++++++++------- lib/ctf-ir/fields.c | 6 +++--- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/lib/ctf-ir/field-types.c b/lib/ctf-ir/field-types.c index 0cd55f4d..6df6bdf1 100644 --- a/lib/ctf-ir/field-types.c +++ b/lib/ctf-ir/field-types.c @@ -1295,13 +1295,18 @@ bt_ctf_field_type_enumeration_find_mappings_by_name( iter->u.name_quark = g_quark_try_string(name); if (!iter->u.name_quark) { - BT_LOGE("Cannot get GQuark: string=\"%s\"", name); + BT_LOGV("No such enumeration field type mapping name: " + "ft-addr=%p, mapping-name=\"%s\"", + type, name); goto error; } /* Advance iterator to first entry, or leave index at -1. */ if (bt_ctf_field_type_enumeration_mapping_iterator_next(iter)) { /* No entry found. */ + BT_LOGV("No such enumeration field type mapping name: " + "ft-addr=%p, mapping-name=\"%s\"", + type, name); goto error; } @@ -2198,14 +2203,19 @@ struct bt_ctf_field_type *bt_ctf_field_type_structure_get_field_type_by_name( name_quark = g_quark_try_string(name); if (!name_quark) { - BT_LOGE("Cannot get GQuark: string=\"%s\"", name); + BT_LOGV("No such structure field type field name: " + "ft-addr=%p, field-name=\"%s\"", + type, name); goto end; } structure = container_of(type, struct bt_ctf_field_type_structure, parent); if (!g_hash_table_lookup_extended(structure->field_name_to_index, - GUINT_TO_POINTER(name_quark), NULL, (gpointer *)&index)) { + GUINT_TO_POINTER(name_quark), NULL, (gpointer *)&index)) { + BT_LOGV("No such structure field type field name: " + "ft-addr=%p, field-name=\"%s\"", + type, name); goto end; } @@ -2482,13 +2492,18 @@ struct bt_ctf_field_type *bt_ctf_field_type_variant_get_field_type_by_name( name_quark = g_quark_try_string(field_name); if (!name_quark) { - BT_LOGE("Cannot get GQuark: string=\"%s\"", field_name); + BT_LOGV("No such variant field type field name: " + "ft-addr=%p, field-name=\"%s\"", + type, field_name); goto end; } variant = container_of(type, struct bt_ctf_field_type_variant, parent); if (!g_hash_table_lookup_extended(variant->field_name_to_index, - GUINT_TO_POINTER(name_quark), NULL, (gpointer *)&index)) { + GUINT_TO_POINTER(name_quark), NULL, (gpointer *)&index)) { + BT_LOGV("No such variant field type field name: " + "ft-addr=%p, field-name=\"%s\"", + type, field_name); goto end; } @@ -3414,7 +3429,9 @@ int bt_ctf_field_type_structure_get_field_name_index( name_quark = g_quark_try_string(name); if (!name_quark) { - BT_LOGE("Cannot get GQuark: string=\"%s\"", name); + BT_LOGV("No such structure field type field name: " + "ft-addr=%p, field-name=\"%s\"", + type, name); ret = -1; goto end; } @@ -3424,6 +3441,9 @@ int bt_ctf_field_type_structure_get_field_name_index( if (!g_hash_table_lookup_extended(structure->field_name_to_index, GUINT_TO_POINTER(name_quark), NULL, (gpointer *)&index)) { + BT_LOGV("No such structure field type field name: " + "ft-addr=%p, field-name=\"%s\"", + type, name); ret = -1; goto end; } @@ -3463,7 +3483,9 @@ int bt_ctf_field_type_variant_get_field_name_index( name_quark = g_quark_try_string(name); if (!name_quark) { - BT_LOGE("Cannot get GQuark: string=\"%s\"", name); + BT_LOGV("No such variant field type field name: " + "ft-addr=%p, field-name=\"%s\"", + type, name); ret = -1; goto end; } @@ -3473,6 +3495,9 @@ int bt_ctf_field_type_variant_get_field_name_index( if (!g_hash_table_lookup_extended(variant->field_name_to_index, GUINT_TO_POINTER(name_quark), NULL, (gpointer *)&index)) { + BT_LOGV("No such variant field type field name: " + "ft-addr=%p, field-name=\"%s\"", + type, name); ret = -1; goto end; } diff --git a/lib/ctf-ir/fields.c b/lib/ctf-ir/fields.c index c1553547..30466a8b 100644 --- a/lib/ctf-ir/fields.c +++ b/lib/ctf-ir/fields.c @@ -546,7 +546,7 @@ struct bt_ctf_field *bt_ctf_field_structure_get_field_by_name( if (!g_hash_table_lookup_extended(structure->field_name_to_index, GUINT_TO_POINTER(field_quark), NULL, (gpointer *)&index)) { - BT_LOGW("Invalid parameter: no such field in structure field's type: " + BT_LOGV("Invalid parameter: no such field in structure field's type: " "struct-field-addr=%p, struct-ft-addr=%p, " "field-ft-addr=%p, name=\"%s\"", field, field->type, field_type, name); @@ -706,7 +706,7 @@ int bt_ctf_field_structure_set_field(struct bt_ctf_field *field, if (!g_hash_table_lookup_extended(structure->field_name_to_index, GUINT_TO_POINTER(field_quark), NULL, (gpointer *) &index)) { - BT_LOGW("Invalid parameter: no such field in structure field's type: " + BT_LOGV("Invalid parameter: no such field in structure field's type: " "struct-field-addr=%p, struct-ft-addr=%p, " "field-ft-addr=%p, name=\"%s\"", field, field->type, value->type, name); @@ -804,7 +804,7 @@ struct bt_ctf_field *bt_ctf_field_sequence_get_field(struct bt_ctf_field *field, sequence = container_of(field, struct bt_ctf_field_sequence, parent); if (!sequence->elements) { - BT_LOGW("Sequence field's elements do not exist: addr=%p", + BT_LOGV("Sequence field's elements do not exist: addr=%p", field); goto end; } -- 2.34.1