Fix: ctf: assert that name is not NULL in warn_meaningless_field()
[babeltrace.git] / src / plugins / ctf / common / metadata / ctf-meta-warn-meaningless-header-fields.c
index e8a9022028bb1506ecf0bf4b5f681588e25f8040..9a9d765a7f51c6d8f0bc52828afb78f7064a184f 100644 (file)
@@ -15,7 +15,7 @@
 #define BT_COMP_LOG_SELF_COMP (log_cfg->self_comp)
 #define BT_LOG_OUTPUT_LEVEL (log_cfg->log_level)
 #define BT_LOG_TAG "PLUGIN/CTF/META/WARN-MEANINGLESS-HEADER-FIELDS"
-#include "plugins/comp-logging.h"
+#include "logging/comp-logging.h"
 
 #include <babeltrace2/babeltrace.h>
 #include "common/macros.h"
@@ -32,6 +32,7 @@ static inline
 void warn_meaningless_field(const char *name, const char *scope_name,
                struct meta_log_config *log_cfg)
 {
+       BT_ASSERT(name);
        BT_COMP_LOGW("User field found in %s: ignoring: name=\"%s\"",
                scope_name, name);
 }
@@ -46,6 +47,11 @@ void warn_meaningless_fields(struct ctf_field_class *fc, const char *name,
                goto end;
        }
 
+       /*
+        * 'name' is guaranteed to be non-NULL whenever the field class is not a
+        * structure. In the case of a structure field class, its members' names
+        * are used.
+        */
        switch (fc->type) {
        case CTF_FIELD_CLASS_TYPE_FLOAT:
        case CTF_FIELD_CLASS_TYPE_STRING:
This page took 0.025387 seconds and 4 git commands to generate.