aboutsummaryrefslogtreecommitdiff
path: root/include/libssh/buffer.h
diff options
context:
space:
mode:
authorPino Toscano <ptoscano@redhat.com>2018-06-27 14:10:26 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-08-01 11:04:33 +0200
commit12284b75fa5e5f6439223c07cbeb49a5eadc9c6b (patch)
tree028c4c036d3d37ce32b7812b8aa6d7d948ca6a2b /include/libssh/buffer.h
parentafa4021ded6e58da4ee4d01dbf4e503d3711d002 (diff)
downloadlibssh-12284b75fa5e5f6439223c07cbeb49a5eadc9c6b.tar.gz
libssh-12284b75fa5e5f6439223c07cbeb49a5eadc9c6b.tar.xz
libssh-12284b75fa5e5f6439223c07cbeb49a5eadc9c6b.zip
buffer: Add and use ssh_buffer_allocate_size()
Add a small helper for ssh_buffer to ensure that the buffer has a certain amount of space already preallocated. This can be useful in case it is known how much data is going to be added to a buffer, to avoid multiple reallocations. Make use of it in few places in the library. Signed-off-by: Pino Toscano <ptoscano@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'include/libssh/buffer.h')
-rw-r--r--include/libssh/buffer.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/libssh/buffer.h b/include/libssh/buffer.h
index 0765ce07..2119f2cc 100644
--- a/include/libssh/buffer.h
+++ b/include/libssh/buffer.h
@@ -51,6 +51,7 @@ int ssh_buffer_add_u64(ssh_buffer buffer, uint64_t data);
int ssh_buffer_validate_length(struct ssh_buffer_struct *buffer, size_t len);
void *ssh_buffer_allocate(struct ssh_buffer_struct *buffer, uint32_t len);
+int ssh_buffer_allocate_size(struct ssh_buffer_struct *buffer, uint32_t len);
int ssh_buffer_pack_va(struct ssh_buffer_struct *buffer,
const char *format,
int argc,