logging: strip down and clean `log.h` and `log.c`
[babeltrace.git] / src / plugins / ctf / common / metadata / ctf-meta-resolve.cpp
index 06fa55f5e0180c8ad64bc8b3aae60f66f72be22e..1f7ffe57c388d0930db9fdc843731c15980e8c17 100644 (file)
@@ -5,27 +5,24 @@
  * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
  */
 
+#include <glib.h>
+#include <inttypes.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <babeltrace2/babeltrace.h>
+
 #define BT_COMP_LOG_SELF_COMP       (ctx->self_comp)
 #define BT_COMP_LOG_SELF_COMP_CLASS (ctx->self_comp_class)
-#define BT_LOG_OUTPUT_LEVEL         (ctx->log_level)
+#define BT_LOG_OUTPUT_LEVEL         ((enum bt_log_level) ctx->log_level)
 #define BT_LOG_TAG                  "PLUGIN/CTF/META/RESOLVE"
+#include "logging.hpp"
 #include "logging/comp-logging.h"
 
-#include <babeltrace2/babeltrace.h>
-#include "common/macros.h"
 #include "common/assert.h"
 #include "common/common.h"
-#include <glib.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <string.h>
-#include <inttypes.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <glib.h>
 
 #include "ctf-meta-visitors.hpp"
-#include "logging.hpp"
 
 using field_class_stack_t = GPtrArray;
 
@@ -278,7 +275,7 @@ end:
 /*
  * Destroys a path token.
  */
-static void ptokens_destroy_func(gpointer ptoken, gpointer data)
+static void ptokens_destroy_func(gpointer ptoken, gpointer)
 {
     g_string_free((GString *) ptoken, TRUE);
 }
@@ -645,7 +642,7 @@ static int pathstr_to_field_path(const char *pathstr, struct ctf_field_path *fie
 
     if (BT_LOG_ON_TRACE && ret == 0) {
         GString *field_path_pretty = ctf_field_path_string(field_path);
-        const char *field_path_pretty_str = field_path_pretty ? field_path_pretty->str : NULL;
+        const char *field_path_pretty_str = field_path_pretty ? field_path_pretty->str : "(null)";
 
         BT_COMP_LOGD("Found field path: path=\"%s\", field-path=\"%s\"", pathstr,
                      field_path_pretty_str);
@@ -728,8 +725,10 @@ static int64_t get_field_paths_lca_index(struct ctf_field_path *field_path1,
     if (BT_LOG_ON_TRACE) {
         GString *field_path1_pretty = ctf_field_path_string(field_path1);
         GString *field_path2_pretty = ctf_field_path_string(field_path2);
-        const char *field_path1_pretty_str = field_path1_pretty ? field_path1_pretty->str : NULL;
-        const char *field_path2_pretty_str = field_path2_pretty ? field_path2_pretty->str : NULL;
+        const char *field_path1_pretty_str =
+            field_path1_pretty ? field_path1_pretty->str : "(null)";
+        const char *field_path2_pretty_str =
+            field_path2_pretty ? field_path2_pretty->str : "(null)";
 
         BT_COMP_LOGD("Finding lowest common ancestor (LCA) between two field paths: "
                      "field-path-1=\"%s\", field-path-2=\"%s\"",
@@ -874,8 +873,6 @@ static int validate_target_field_path(struct ctf_field_path *target_field_path,
         break;
     case CTF_FIELD_CLASS_TYPE_SEQUENCE:
     {
-        struct ctf_field_class_int *int_fc = ctf_field_class_as_int(target_fc);
-
         if (target_fc->type != CTF_FIELD_CLASS_TYPE_INT &&
             target_fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
             _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE(
@@ -886,6 +883,8 @@ static int validate_target_field_path(struct ctf_field_path *target_field_path,
             goto end;
         }
 
+        ctf_field_class_int *int_fc = ctf_field_class_as_int(target_fc);
+
         if (int_fc->is_signed) {
             _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE(
                 "Sequence field class's length field class is not an unsigned integer field class: "
@@ -1207,7 +1206,6 @@ end:
     return ret;
 }
 
-BT_HIDDEN
 int ctf_trace_class_resolve_field_classes(struct ctf_trace_class *tc,
                                           struct meta_log_config *log_cfg)
 {
This page took 0.025529 seconds and 4 git commands to generate.