Move to kernel style SPDX license identifiers
[babeltrace.git] / src / ctf-writer / resolve.c
index 7bcc924c4024e8510ce287d264c7dbe3e7e158eb..c6316c0bfee0e40ebb1473e5065aa7dfc9bb2be3 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"
@@ -201,15 +180,10 @@ size_t type_stack_size(type_stack *stack)
 static
 struct type_stack_frame *type_stack_peek(type_stack *stack)
 {
-       struct type_stack_frame *entry = NULL;
+       BT_ASSERT(stack);
+       BT_ASSERT(!type_stack_empty(stack));
 
-       if (!stack || type_stack_empty(stack)) {
-               goto end;
-       }
-
-       entry = g_ptr_array_index(stack, stack->len - 1);
-end:
-       return entry;
+       return g_ptr_array_index(stack, stack->len - 1);
 }
 
 /*
@@ -218,19 +192,12 @@ end:
  * Return value is owned by `stack`.
  */
 static
-struct type_stack_frame *type_stack_at(type_stack *stack,
-               size_t index)
+struct type_stack_frame *type_stack_at(type_stack *stack, size_t index)
 {
-       struct type_stack_frame *entry = NULL;
+       BT_ASSERT(stack);
+       BT_ASSERT(index < stack->len);
 
-       if (!stack || index >= stack->len) {
-               goto end;
-       }
-
-       entry = g_ptr_array_index(stack, index);
-
-end:
-       return entry;
+       return g_ptr_array_index(stack, index);
 }
 
 /*
@@ -987,7 +954,7 @@ int validate_target_field_path(struct bt_ctf_field_path *target_field_path,
                }
                break;
        default:
-               abort();
+               bt_common_abort();
        }
 
 end:
@@ -1024,7 +991,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) {
@@ -1099,7 +1066,7 @@ int resolve_sequence_or_variant_type(struct bt_ctf_field_type_common *type,
                }
                break;
        default:
-               abort();
+               bt_common_abort();
        }
 
 end:
This page took 0.02403 seconds and 4 git commands to generate.