- if (!array_obj || !element_obj) {
- BT_LOGW("Invalid parameter: array value or element value is NULL: "
- "index=%" PRIu64 ", array-value-addr=%p, element-value-addr=%p",
- index, array_obj, element_obj);
- ret = BT_VALUE_STATUS_INVAL;
- goto end;
- }
-
- if (!bt_value_is_array(array_obj)) {
- BT_LOGW("Invalid parameter: value is not an array value: addr=%p, "
- "type=%s", array_obj,
- bt_value_type_string(array_obj->type));
- ret = BT_VALUE_STATUS_INVAL;
- goto end;
- }
-
- if (index >= typed_array_obj->garray->len) {
- BT_LOGW("Invalid parameter: index is out of bounds: "
- "addr=%p, index=%" PRIu64 ", size=%u",
- array_obj, index, typed_array_obj->garray->len);
- ret = BT_VALUE_STATUS_INVAL;
- goto end;
- }
-
- if (array_obj->is_frozen) {
- BT_LOGW("Invalid parameter: value is frozen: addr=%p",
- array_obj);
- ret = BT_VALUE_STATUS_FROZEN;
- goto end;
- }
-
- bt_put(g_ptr_array_index(typed_array_obj->garray, index));
+ BT_ASSERT_PRE_NON_NULL(array_obj, "Array value object");
+ BT_ASSERT_PRE_NON_NULL(element_obj, "Element value object");
+ BT_ASSERT_PRE_VALUE_IS_TYPE(array_obj, BT_VALUE_TYPE_ARRAY);
+ BT_ASSERT_PRE_VALUE_HOT(array_obj, "Array value object");
+ BT_ASSERT_PRE_VALUE_INDEX_IN_BOUNDS(index,
+ typed_array_obj->garray->len);
+ bt_object_put_ref(g_ptr_array_index(typed_array_obj->garray, index));