void *data;
unsigned written;
unsigned allocated;
- unsigned error;
};
static struct membuffer *membuffer_create(void)
{
unsigned dest_size = buf->written + bytes;
- if (buf->error)
- return 0;
if (dest_size > buf->allocated) {
do {
buf->allocated <<= 1;
membuffer_write(buf, value, len);
}
-static unsigned membuffer_error(const struct membuffer *buf)
-{
- return buf->error;
-}
-
static void membuffer_free(struct membuffer *buf)
{
free(buf->data);
static void *membuffer_detach(struct membuffer *buf)
{
- void *ret;
-
- if (buf->error)
- return 0;
- ret = para_realloc(buf->data, buf->written);
+ void *ret = para_realloc(buf->data, buf->written);
free(buf);
return ret;
}
else
PARA_ERROR_LOG("invalid tag item: %s\n", tag->item);
}
- if (membuffer_error(buf)) {
- membuffer_free(buf);
- return 0;
- }
-
*out_size = membuffer_get_size(buf);
*out_buffer = membuffer_detach(buf);
return 1;