#include <stdio.h>
#include <stddef.h>
#include <stdbool.h>
-#include <assert.h>
+#include <babeltrace/assert-internal.h>
#include <string.h>
#include <babeltrace/bitfield-internal.h>
#include <babeltrace/babeltrace.h>
int ret = 0;
struct stack_entry *entry;
- assert(stack);
- assert(base_type);
+ BT_ASSERT(stack);
+ BT_ASSERT(base_type);
BT_LOGV("Pushing field type on stack: stack-addr=%p, "
"ft-addr=%p, ft-id=%s, base-length=%zu, "
static inline
unsigned int stack_size(struct stack *stack)
{
- assert(stack);
+ BT_ASSERT(stack);
return stack->entries->len;
}
static
void stack_pop(struct stack *stack)
{
- assert(stack);
- assert(stack_size(stack));
+ BT_ASSERT(stack);
+ BT_ASSERT(stack_size(stack));
BT_LOGV("Popping from stack: "
"stack-addr=%p, stack-size-before=%u, stack-size-after=%u",
stack, stack->entries->len, stack->entries->len - 1);
static
void stack_clear(struct stack *stack)
{
- assert(stack);
+ BT_ASSERT(stack);
if (!stack_empty(stack)) {
g_ptr_array_remove_range(stack->entries, 0, stack_size(stack));
}
- assert(stack_empty(stack));
+ BT_ASSERT(stack_empty(stack));
}
static inline
struct stack_entry *stack_top(struct stack *stack)
{
- assert(stack);
- assert(stack_size(stack));
+ BT_ASSERT(stack);
+ BT_ASSERT(stack_size(stack));
return g_ptr_array_index(stack->entries, stack->entries->len - 1);
}
mant_dig =
bt_field_type_floating_point_get_mantissa_digits(
field_type);
- assert(exp_dig >= 0);
- assert(mant_dig >= 0);
+ BT_ASSERT(exp_dig >= 0);
+ BT_ASSERT(mant_dig >= 0);
size = exp_dig + mant_dig;
break;
}
int_type = bt_field_type_enumeration_get_container_type(
field_type);
- assert(int_type);
+ BT_ASSERT(int_type);
size = get_basic_field_type_size(btr, int_type);
BT_PUT(int_type);
break;
BITS_TO_BYTES_FLOOR(stitch_at_from_addr(btr));
buf_byte_at = BITS_TO_BYTES_FLOOR(buf_at_from_addr(btr));
nb_bytes = BITS_TO_BYTES_CEIL(sz);
- assert(nb_bytes > 0);
- assert(btr->buf.addr);
+ BT_ASSERT(nb_bytes > 0);
+ BT_ASSERT(btr->buf.addr);
memcpy(&btr->stitch.buf[stitch_byte_at], &btr->buf.addr[buf_byte_at],
nb_bytes);
btr->stitch.at += sz;
ret = bt_field_type_floating_point_get_mantissa_digits(
btr->cur_basic_field_type);
- assert(ret == 24);
+ BT_ASSERT(ret == 24);
ret = bt_field_type_floating_point_get_exponent_digits(
btr->cur_basic_field_type);
- assert(ret == 8);
+ BT_ASSERT(ret == 8);
status = read_unsigned_bitfield(buf, at, field_size, bo, &v);
if (status != BT_BTR_STATUS_OK) {
BT_LOGW("Cannot read unsigned 32-bit bit array for floating point number field: "
ret = bt_field_type_floating_point_get_mantissa_digits(
btr->cur_basic_field_type);
- assert(ret == 53);
+ BT_ASSERT(ret == 53);
ret = bt_field_type_floating_point_get_exponent_digits(
btr->cur_basic_field_type);
- assert(ret == 11);
+ BT_ASSERT(ret == 11);
status = read_unsigned_bitfield(buf, at, field_size, bo,
&f64.u);
if (status != BT_BTR_STATUS_OK) {
int_field_type = bt_field_type_enumeration_get_container_type(
btr->cur_basic_field_type);
- assert(int_field_type);
+ BT_ASSERT(int_field_type);
status = read_basic_int_and_call(btr, buf, at,
int_field_type, btr->cur_basic_field_type);
bt_put(int_field_type);
if (field_size <= available) {
/* We have all the bits; decode and set now */
- assert(btr->buf.addr);
+ BT_ASSERT(btr->buf.addr);
status = read_basic_and_call_cb(btr, btr->buf.addr,
buf_at_from_addr(btr));
if (status != BT_BTR_STATUS_OK) {
goto end;
}
- assert(buf_at_from_addr(btr) % 8 == 0);
+ BT_ASSERT(buf_at_from_addr(btr) % 8 == 0);
available_bytes = BITS_TO_BYTES_FLOOR(available_bits(btr));
buf_at_bytes = BITS_TO_BYTES_FLOOR(buf_at_from_addr(btr));
- assert(btr->buf.addr);
+ BT_ASSERT(btr->buf.addr);
first_chr = &btr->buf.addr[buf_at_bytes];
result = memchr(first_chr, '\0', available_bytes);
{
enum bt_btr_status status;
- assert(btr->cur_basic_field_type);
+ BT_ASSERT(btr->cur_basic_field_type);
switch (bt_field_type_get_type_id(btr->cur_basic_field_type)) {
case BT_FIELD_TYPE_ID_INTEGER:
{
enum bt_btr_status status;
- assert(btr->cur_basic_field_type);
+ BT_ASSERT(btr->cur_basic_field_type);
switch (bt_field_type_get_type_id(btr->cur_basic_field_type)) {
case BT_FIELD_TYPE_ID_INTEGER:
size_t offset, size_t packet_offset, size_t sz,
enum bt_btr_status *status)
{
- assert(btr);
- assert(BYTES_TO_BITS(sz) >= offset);
+ BT_ASSERT(btr);
+ BT_ASSERT(BYTES_TO_BITS(sz) >= offset);
reset(btr);
btr->buf.addr = buf;
btr->buf.offset = offset;
const uint8_t *buf, size_t sz,
enum bt_btr_status *status)
{
- assert(btr);
- assert(buf);
- assert(sz > 0);
+ BT_ASSERT(btr);
+ BT_ASSERT(buf);
+ BT_ASSERT(sz > 0);
btr->buf.addr = buf;
btr->buf.offset = 0;
btr->buf.at = 0;