Move to kernel style SPDX license identifiers
[babeltrace.git] / src / plugins / ctf / fs-sink / translate-ctf-ir-to-tsdl.c
index a94c615e4f410040c9852d72cd74a5f1f90454c3..85f6bee7e51b27c02c6a6ef5f3b220a8a94ad345 100644 (file)
@@ -1,25 +1,11 @@
 /*
- * Copyright 2019 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.
+ * SPDX-License-Identifier: MIT
  *
- * 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.
+ * Copyright 2019 Philippe Proulx <pproulx@efficios.com>
  */
 
+#include "translate-ctf-ir-to-tsdl.h"
+
 #include <babeltrace2/babeltrace.h>
 #include "common/macros.h"
 #include <stdio.h>
@@ -136,7 +122,7 @@ void append_integer_field_class_from_props(struct ctx *ctx, unsigned int size,
                        g_string_append(ctx->tsdl, "x");
                        break;
                default:
-                       abort();
+                       bt_common_abort();
                }
 
                g_string_append_c(ctx->tsdl, ';');
@@ -216,11 +202,10 @@ void append_integer_field_class(struct ctx *ctx,
 {
        const bt_field_class *ir_fc = fc->base.base.ir_fc;
        bt_field_class_type type = bt_field_class_get_type(ir_fc);
-       bool is_signed = type == BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION ||
-               type == BT_FIELD_CLASS_TYPE_SIGNED_INTEGER;
+       bool is_signed = bt_field_class_type_is(type,
+               BT_FIELD_CLASS_TYPE_SIGNED_INTEGER);
 
-       if (type == BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION ||
-                       type == BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION) {
+       if (bt_field_class_type_is(type, BT_FIELD_CLASS_TYPE_ENUMERATION)) {
                g_string_append(ctx->tsdl, "enum : ");
        }
 
@@ -229,8 +214,7 @@ void append_integer_field_class(struct ctx *ctx,
                bt_field_class_integer_get_preferred_display_base(ir_fc),
                NULL, NULL, false);
 
-       if (type == BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION ||
-                       type == BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION) {
+       if (bt_field_class_type_is(type, BT_FIELD_CLASS_TYPE_ENUMERATION)) {
                uint64_t i;
 
                g_string_append(ctx->tsdl, " {\n");
@@ -334,7 +318,8 @@ void append_float_field_class(struct ctx *ctx,
 {
        unsigned int mant_dig, exp_dig;
 
-       if (bt_field_class_get_type(fc->base.base.ir_fc) == BT_FIELD_CLASS_TYPE_SINGLE_PRECISION_REAL) {
+       if (bt_field_class_get_type(fc->base.base.ir_fc) ==
+                       BT_FIELD_CLASS_TYPE_SINGLE_PRECISION_REAL) {
                mant_dig = 24;
                exp_dig = 8;
        } else {
@@ -482,14 +467,14 @@ void append_struct_field_class_members(struct ctx *ctx,
                                ctx->indent_level++;
 
                                for (i = 0; i < var_fc->options->len; i++) {
-                                       struct fs_sink_ctf_named_field_class *named_fc =
+                                       struct fs_sink_ctf_named_field_class *option_named_fc =
                                                fs_sink_ctf_field_class_variant_borrow_option_by_index(
                                                        var_fc, i);
 
                                        append_indent(ctx);
                                        g_string_append_printf(ctx->tsdl,
                                                "\"%s\" = %" PRIu64 ",\n",
-                                               named_fc->name->str, i);
+                                               option_named_fc->name->str, i);
                                }
 
                                append_end_block(ctx);
@@ -588,7 +573,7 @@ void append_field_class(struct ctx *ctx, struct fs_sink_ctf_field_class *fc)
                append_variant_field_class(ctx, (void *) fc);
                break;
        default:
-               abort();
+               bt_common_abort();
        }
 }
 
@@ -682,7 +667,7 @@ void append_event_class(struct ctx *ctx, struct fs_sink_ctf_event_class *ec)
                        level = 14;
                        break;
                default:
-                       abort();
+                       bt_common_abort();
                }
 
                g_string_append_printf(ctx->tsdl, "%u;\n", level);
@@ -975,7 +960,7 @@ void translate_trace_ctf_ir_to_tsdl(struct fs_sink_ctf_trace *trace,
                                 * This is checked in
                                 * translate_trace_trace_ir_to_ctf_ir().
                                 */
-                               abort();
+                               bt_common_abort();
                        }
 
                        g_string_append(tsdl, ";\n");
This page took 0.024367 seconds and 4 git commands to generate.