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