#include <config.h>
#include "ofpbuf.h"
-#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "dynamic-string.h"
void
ofpbuf_use_const(struct ofpbuf *b, const void *data, size_t size)
{
- ofpbuf_use__(b, (void *) data, size, OFPBUF_STACK);
+ ofpbuf_use__(b, CONST_CAST(void *, data), size, OFPBUF_STACK);
b->size = size;
}
if (n) {
*n = b->size - initial_size;
}
- return (char *) s;
+ return CONST_CAST(char *, s);
}
ofpbuf_put(b, &byte, 1);
void
ofpbuf_reserve(struct ofpbuf *b, size_t size)
{
- assert(!b->size);
+ ovs_assert(!b->size);
ofpbuf_prealloc_tailroom(b, size);
b->data = (char*)b->data + size;
}
void *
ofpbuf_at_assert(const struct ofpbuf *b, size_t offset, size_t size)
{
- assert(offset + size <= b->size);
+ ovs_assert(offset + size <= b->size);
return ((char *) b->data) + offset;
}
ofpbuf_pull(struct ofpbuf *b, size_t size)
{
void *data = b->data;
- assert(b->size >= size);
+ ovs_assert(b->size >= size);
b->data = (char*)b->data + size;
b->size -= size;
return data;