Move to kernel style SPDX license identifiers
[babeltrace.git] / src / plugins / ctf / common / metadata / decoder.c
index 7407ad339dbf927bce3f741f29e61ac6782a8a64..342cba2fd82f7a1543d91adba5a8dca94c6a1296 100644 (file)
@@ -1,15 +1,7 @@
 /*
- * Copyright 2016-2017 - Philippe Proulx <pproulx@efficios.com>
+ * SPDX-License-Identifier: MIT
  *
- * 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.
+ * Copyright 2016-2017 Philippe Proulx <pproulx@efficios.com>
  */
 
 #define BT_COMP_LOG_SELF_COMP (mdec->config.self_comp)
 #include "decoder.h"
 #include "scanner.h"
 #include "logging.h"
+#include "parser-wrap.h"
 
 #define TSDL_MAGIC     0x75d11d57
 
-extern
-int yydebug;
-
 struct ctf_metadata_decoder {
        struct ctf_scanner *scanner;
        GString *text;
@@ -271,9 +261,11 @@ enum ctf_metadata_decoder_status ctf_metadata_decoder_append_content(
                }
        }
 
+#if YYDEBUG
        if (BT_LOG_ON_TRACE) {
                yydebug = 1;
        }
+#endif
 
        /* Save the file's position: we'll seek back to append the plain text */
        BT_ASSERT(fp);
@@ -341,7 +333,9 @@ enum ctf_metadata_decoder_status ctf_metadata_decoder_append_content(
        }
 
 end:
+#if YYDEBUG
        yydebug = 0;
+#endif
 
        if (fp && close_fp) {
                if (fclose(fp)) {
@@ -359,8 +353,8 @@ BT_HIDDEN
 bt_trace_class *ctf_metadata_decoder_get_ir_trace_class(
                struct ctf_metadata_decoder *mdec)
 {
-       BT_ASSERT(mdec);
-       BT_ASSERT(mdec->config.create_trace_class);
+       BT_ASSERT_DBG(mdec);
+       BT_ASSERT_DBG(mdec->config.create_trace_class);
        return ctf_visitor_generate_ir_get_ir_trace_class(mdec->visitor);
 }
 
@@ -368,23 +362,23 @@ BT_HIDDEN
 struct ctf_trace_class *ctf_metadata_decoder_borrow_ctf_trace_class(
                struct ctf_metadata_decoder *mdec)
 {
-       BT_ASSERT(mdec);
-       BT_ASSERT(mdec->config.create_trace_class);
+       BT_ASSERT_DBG(mdec);
+       BT_ASSERT_DBG(mdec->config.create_trace_class);
        return ctf_visitor_generate_ir_borrow_ctf_trace_class(mdec->visitor);
 }
 
 BT_HIDDEN
 const char *ctf_metadata_decoder_get_text(struct ctf_metadata_decoder *mdec)
 {
-       BT_ASSERT(mdec);
-       BT_ASSERT(mdec->config.keep_plain_text);
+       BT_ASSERT_DBG(mdec);
+       BT_ASSERT_DBG(mdec->config.keep_plain_text);
        return mdec->text->str;
 }
 
 BT_HIDDEN
 int ctf_metadata_decoder_get_byte_order(struct ctf_metadata_decoder *mdec)
 {
-       BT_ASSERT(mdec);
+       BT_ASSERT_DBG(mdec);
        return mdec->bo;
 }
 
@@ -394,7 +388,7 @@ int ctf_metadata_decoder_get_uuid(struct ctf_metadata_decoder *mdec,
 {
        int ret = 0;
 
-       BT_ASSERT(mdec);
+       BT_ASSERT_DBG(mdec);
 
        if (!mdec->is_uuid_set) {
                ret = -1;
This page took 0.025034 seconds and 4 git commands to generate.