Cleanup: add `#include <stdbool.h>` whenever `bool` type is used
[babeltrace.git] / src / plugins / ctf / common / metadata / ctf-meta-resolve.c
index 630f14ed5e780ab11100c346f6df187260fa9d15..074c5dd13d431942d44a49b6bfb46827d7b7773e 100644 (file)
@@ -23,6 +23,7 @@
 #include "common/assert.h"
 #include "common/common.h"
 #include <glib.h>
+#include <stdbool.h>
 #include <stdint.h>
 #include <string.h>
 #include <inttypes.h>
@@ -181,15 +182,10 @@ size_t field_class_stack_size(field_class_stack *stack)
 static
 struct field_class_stack_frame *field_class_stack_peek(field_class_stack *stack)
 {
-       struct field_class_stack_frame *entry = NULL;
+       BT_ASSERT(stack);
+       BT_ASSERT(!field_class_stack_empty(stack));
 
-       if (!stack || field_class_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);
 }
 
 /*
@@ -199,16 +195,10 @@ static
 struct field_class_stack_frame *field_class_stack_at(field_class_stack *stack,
                size_t index)
 {
-       struct field_class_stack_frame *entry = NULL;
-
-       if (!stack || index >= stack->len) {
-               goto end;
-       }
-
-       entry = g_ptr_array_index(stack, index);
+       BT_ASSERT(stack);
+       BT_ASSERT(index < stack->len);
 
-end:
-       return entry;
+       return g_ptr_array_index(stack, index);
 }
 
 /*
@@ -770,6 +760,7 @@ void get_ctx_stack_field_path(struct resolve_context *ctx,
  * Returns the index of the lowest common ancestor of two field path
  * objects having the same root scope.
  */
+static
 int64_t get_field_paths_lca_index(struct ctf_field_path *field_path1,
                struct ctf_field_path *field_path2,
                struct resolve_context *ctx)
This page took 0.024138 seconds and 4 git commands to generate.