kore

An easy to use, scalable and secure web application framework for writing web APIs in C.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit b4deea82b43b5592af425de3d4c680882cb869ca
parent a74fffe40c7d8e0a04d0fa76becd16dcba710927
Author: Joris Vink <joris@coders.se>
Date:   Wed,  5 Jun 2013 11:27:03 +0200

add kore_buf_appendb() which allows us to append a kore_buf to another one.
(releases the kore_buf that is being appended while at it).

Diffstat:
includes/kore.h | 1+
src/buf.c | 10++++++++++
2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/includes/kore.h b/includes/kore.h @@ -181,6 +181,7 @@ void kore_buf_append(struct kore_buf *, u_int8_t *, u_int32_t); u_int8_t *kore_buf_release(struct kore_buf *, u_int32_t *); void kore_buf_appendf(struct kore_buf *, const char *, ...); void kore_buf_appendv(struct kore_buf *, struct buf_vec *, u_int16_t); +void kore_buf_appendb(struct kore_buf *, struct kore_buf *); struct spdy_header_block *spdy_header_block_create(int); struct spdy_stream *spdy_stream_lookup(struct connection *, u_int32_t); diff --git a/src/buf.c b/src/buf.c @@ -63,6 +63,16 @@ kore_buf_append(struct kore_buf *buf, u_int8_t *d, u_int32_t len) } void +kore_buf_appendb(struct kore_buf *buf, struct kore_buf *src) +{ + u_int8_t *d; + u_int32_t len; + + d = kore_buf_release(src, &len); + kore_buf_append(buf, d, len); +} + +void kore_buf_appendv(struct kore_buf *buf, struct buf_vec *v, u_int16_t count) { u_int16_t i;