Commit 97fcea89 authored by Niels Möller's avatar Niels Möller

(nettle_buffer_init_realloc): New function.

Rev: src/nettle/buffer.c:1.6
Rev: src/nettle/buffer.h:1.5
parent 9c9123a9
......@@ -54,6 +54,18 @@ nettle_buffer_grow(struct nettle_buffer *buffer,
return 1;
}
void
nettle_buffer_init_realloc(struct nettle_buffer *buffer,
void *realloc_ctx,
nettle_realloc_func realloc)
{
buffer->contents = NULL;
buffer->alloc = 0;
buffer->realloc = realloc;
buffer->realloc_ctx = realloc_ctx;
buffer->size = 0;
}
void
nettle_buffer_init_size(struct nettle_buffer *buffer,
unsigned length, uint8_t *space)
......
......@@ -34,8 +34,8 @@ struct nettle_buffer
/* Allocated size */
unsigned alloc;
nettle_realloc_func *realloc;
void *realloc_ctx;
nettle_realloc_func *realloc;
/* Current size */
unsigned size;
......@@ -45,6 +45,11 @@ struct nettle_buffer
void
nettle_buffer_init(struct nettle_buffer *buffer);
void
nettle_buffer_init_realloc(struct nettle_buffer *buffer,
void *realloc_ctx,
nettle_realloc_func realloc);
/* Initializes a buffer of fix size */
void
nettle_buffer_init_size(struct nettle_buffer *buffer,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment