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);
}
/*
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);
}
/*
* 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)