Fix: g_quark_try_string() is usually not a WARN trigger
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 16 May 2017 21:35:42 +0000 (17:35 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 28 May 2017 16:57:43 +0000 (12:57 -0400)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
lib/ctf-ir/field-types.c
lib/ctf-ir/fields.c

index 0cd55f4d4a27a7e9d0da465b3ced4ac12cf27285..6df6bdf1dabd4aca28d699b8181c694133bc0e3c 100644 (file)
@@ -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;
        }
index c1553547f6b4fdf67e0bd366533ec2a3e35e0cb9..30466a8b7d72d9ee27f835854757b0b5ad5c7f85 100644 (file)
@@ -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;
        }
This page took 0.027864 seconds and 4 git commands to generate.