summaryrefslogtreecommitdiff
path: root/sshbuf.h
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2016-11-25 23:22:04 +0000
committerDamien Miller <djm@mindrot.org>2016-11-29 16:48:02 +1100
commita9c746088787549bb5b1ae3add7d06a1b6d93d5e (patch)
tree02fcaaa90ae6ccd042e6197898a1d914592dc57b /sshbuf.h
parentf0ddedee460486fa0e32fefb2950548009e5026e (diff)
downloadopenssh-git-a9c746088787549bb5b1ae3add7d06a1b6d93d5e.tar.gz
upstream commit
split allocation out of sshbuf_reserve() into a separate sshbuf_allocate() function; ok markus@ Upstream-ID: 11b8a2795afeeb1418d508a2c8095b3355577ec2
Diffstat (limited to 'sshbuf.h')
-rw-r--r--sshbuf.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/sshbuf.h b/sshbuf.h
index 52ff017c..1ac4b8c0 100644
--- a/sshbuf.h
+++ b/sshbuf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshbuf.h,v 1.7 2016/05/02 08:49:03 djm Exp $ */
+/* $OpenBSD: sshbuf.h,v 1.8 2016/11/25 23:22:04 djm Exp $ */
/*
* Copyright (c) 2011 Damien Miller
*
@@ -139,6 +139,14 @@ u_char *sshbuf_mutable_ptr(const struct sshbuf *buf);
int sshbuf_check_reserve(const struct sshbuf *buf, size_t len);
/*
+ * Preallocates len additional bytes in buf.
+ * Useful for cases where the caller knows how many bytes will ultimately be
+ * required to avoid realloc in the buffer code.
+ * Returns 0 on success, or a negative SSH_ERR_* error code on failure.
+ */
+int sshbuf_allocate(struct sshbuf *buf, size_t len);
+
+/*
* Reserve len bytes in buf.
* Returns 0 on success and a pointer to the first reserved byte via the
* optional dpp parameter or a negative * SSH_ERR_* error code on failure.