configure: re-enable '-Wunused-parameter'
[babeltrace.git] / src / ctf-writer / resolve.c
index 4636e1c55348786ec6122624ba5cc94244606980..578af1c5322a2845c2587e5e185ba87c70189f0f 100644 (file)
@@ -1,31 +1,10 @@
 /*
- * resolve.c
- *
- * Babeltrace - CTF writer: Type resolving internal
+ * SPDX-License-Identifier: MIT
  *
  * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
  * Copyright 2016 Philippe Proulx <pproulx@efficios.com>
  *
- * Authors: Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *          Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * Babeltrace - CTF writer: Type resolving internal
  */
 
 #define BT_LOG_TAG "CTF-WRITER/RESOLVE"
@@ -299,7 +278,8 @@ end:
  * Destroys a path token.
  */
 static
-void ptokens_destroy_func(gpointer ptoken, gpointer data)
+void ptokens_destroy_func(gpointer ptoken,
+               gpointer data __attribute__((unused)))
 {
        g_string_free(ptoken, TRUE);
 }
@@ -562,7 +542,7 @@ int relative_ptokens_to_field_path(GList *ptokens,
                        }
 
                        for (i = 0; i < tail_field_path_len; i++) {
-                               int index = g_array_index(
+                               int index = bt_g_array_index(
                                        tail_field_path->indexes,
                                        int, i);
 
@@ -683,7 +663,7 @@ struct bt_ctf_field_path *pathstr_to_field_path(const char *pathstr,
                GString *field_path_pretty =
                        bt_ctf_field_path_string(field_path);
                const char *field_path_pretty_str =
-                       field_path_pretty ? field_path_pretty->str : NULL;
+                       field_path_pretty ? field_path_pretty->str : "(null)";
 
                BT_LOGT("Found field path: path=\"%s\", field-path=\"%s\"",
                        pathstr, field_path_pretty_str);
@@ -730,7 +710,7 @@ struct bt_ctf_field_type_common *field_path_to_field_type(
        for (i = 0; i < field_path->indexes->len; i++) {
                struct bt_ctf_field_type_common *child_type;
                int child_index =
-                       g_array_index(field_path->indexes, int, i);
+                       bt_g_array_index(field_path->indexes, int, i);
 
                /* Get child field type */
                child_type = bt_ctf_field_type_common_borrow_field_at_index(type,
@@ -806,9 +786,9 @@ int get_field_paths_lca_index(struct bt_ctf_field_path *field_path1,
                GString *field_path2_pretty =
                        bt_ctf_field_path_string(field_path2);
                const char *field_path1_pretty_str =
-                       field_path1_pretty ? field_path1_pretty->str : NULL;
+                       field_path1_pretty ? field_path1_pretty->str : "(null)";
                const char *field_path2_pretty_str =
-                       field_path2_pretty ? field_path2_pretty->str : NULL;
+                       field_path2_pretty ? field_path2_pretty->str : "(null)";
 
                BT_LOGT("Finding lowest common ancestor (LCA) between two field paths: "
                        "field-path-1=\"%s\", field-path-2=\"%s\"",
@@ -848,9 +828,9 @@ int get_field_paths_lca_index(struct bt_ctf_field_path *field_path1,
                        break;
                }
 
-               target_index = g_array_index(field_path1->indexes, int,
+               target_index = bt_g_array_index(field_path1->indexes, int,
                        lca_index);
-               ctx_index = g_array_index(field_path2->indexes, int,
+               ctx_index = bt_g_array_index(field_path2->indexes, int,
                        lca_index);
 
                if (target_index != ctx_index) {
@@ -931,9 +911,9 @@ int validate_target_field_path(struct bt_ctf_field_path *target_field_path,
                 * Make sure the target field path is located before the
                 * context field path.
                 */
-               target_index = g_array_index(target_field_path->indexes,
+               target_index = bt_g_array_index(target_field_path->indexes,
                        int, lca_index);
-               ctx_index = g_array_index(ctx_field_path->indexes,
+               ctx_index = bt_g_array_index(ctx_field_path->indexes,
                        int, lca_index);
 
                if (target_index >= ctx_index) {
@@ -975,7 +955,7 @@ int validate_target_field_path(struct bt_ctf_field_path *target_field_path,
                }
                break;
        default:
-               abort();
+               bt_common_abort();
        }
 
 end:
@@ -1012,7 +992,7 @@ int resolve_sequence_or_variant_type(struct bt_ctf_field_type_common *type,
                        bt_ctf_field_type_common_variant_get_tag_name(type);
                break;
        default:
-               abort();
+               bt_common_abort();
        }
 
        if (!pathstr) {
@@ -1087,7 +1067,7 @@ int resolve_sequence_or_variant_type(struct bt_ctf_field_type_common *type,
                }
                break;
        default:
-               abort();
+               bt_common_abort();
        }
 
 end:
@@ -1218,7 +1198,6 @@ int resolve_root_type(enum bt_ctf_scope root_scope, struct resolve_context *ctx)
        return ret;
 }
 
-BT_HIDDEN
 int bt_ctf_resolve_types(
                struct bt_ctf_private_value *environment,
                struct bt_ctf_field_type_common *packet_header_type,
This page took 0.02517 seconds and 4 git commands to generate.