eina_binbuf: allow expand & usage of extra bytes.
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Mon, 19 Dec 2016 20:35:38 +0000 (18:35 -0200)
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Tue, 20 Dec 2016 12:18:32 +0000 (10:18 -0200)
commit09825cbe5d87b208f814e8d941a4692d1aaab46a
treec030fc3d1a6543f64580b346f02982abe4c582f2
parent3680ae0bab2d0df20269fdc3fccb57a49578da27
eina_binbuf: allow expand & usage of extra bytes.

Some code needs to read directly into eina_binbuf to avoid an extra
copy from eina_binbuf_append* variants.

This can be achieved by using eina_binbuf_expand(), which returns a
write-able slice of the spare bytes. Once they are used,
eina_binbuf_use() should be called to increment "buf->len", which is
used by all other binbuf functions such as eina_binbuf_length_get() or
eina_binbuf_append_slice().
src/lib/eina/eina_binbuf.h
src/lib/eina/eina_binbuf_template_c.x
src/lib/eina/eina_strbuf_common.c
src/lib/eina/eina_strbuf_common.h
src/tests/eina/eina_test_binbuf.c