Commit 3b665789 authored by Niels Möller's avatar Niels Möller

(nettle_buffer_reset): New function.

(nettle_buffer_copy): New function.

Rev: src/nettle/buffer.c:1.5
Rev: src/nettle/buffer.h:1.4
parent e563d808
......@@ -76,6 +76,12 @@ nettle_buffer_clear(struct nettle_buffer *buffer)
buffer->size = 0;
}
void
nettle_buffer_reset(struct nettle_buffer *buffer)
{
buffer->size = 0;
}
uint8_t *
nettle_buffer_space(struct nettle_buffer *buffer,
unsigned length)
......@@ -103,3 +109,10 @@ nettle_buffer_write(struct nettle_buffer *buffer,
else
return 0;
}
int
nettle_buffer_copy(struct nettle_buffer *dst,
const struct nettle_buffer *src)
{
nettle_buffer_write(dst, src->size, src->contents);
}
......@@ -53,6 +53,10 @@ nettle_buffer_init_size(struct nettle_buffer *buffer,
void
nettle_buffer_clear(struct nettle_buffer *buffer);
/* Resets the buffer, without freeing the buffer space. */
void
nettle_buffer_reset(struct nettle_buffer *buffer);
int
nettle_buffer_grow(struct nettle_buffer *buffer,
unsigned length);
......@@ -73,4 +77,9 @@ uint8_t *
nettle_buffer_space(struct nettle_buffer *buffer,
unsigned length);
/* Copy the contents of SRC to the end of DST. */
int
nettle_buffer_copy(struct nettle_buffer *dst,
const struct nettle_buffer *src);
#endif /* NETTLE_BUFFER_H_INCLUDED */
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