summaryrefslogtreecommitdiffhomepage
path: root/buffer.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2009-07-06 12:59:13 +0000
committerMatt Johnston <matt@ucc.asn.au>2009-07-06 12:59:13 +0000
commitc742137dc8c8dd2163a2353d3382fdf2cae44c24 (patch)
tree25f52a38fb21d20051e2e44faa40ab25f45a5cad /buffer.c
parent9dc9aff0164ba777ae9806e9608af09aaf1a786e (diff)
New standard linked list to use, rather than adhoc SignKeyList or TCPFwdList
--HG-- branch : agent-client extra : convert_revision : 5465e639cc3f5ee0c6c55f0de6e7b6d5a8769da3
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/buffer.c b/buffer.c
index 579fa6f..7394993 100644
--- a/buffer.c
+++ b/buffer.c
@@ -223,6 +223,20 @@ unsigned char* buf_getstring(buffer* buf, unsigned int *retlen) {
return ret;
}
+/* Return a string as a newly allocated buffer */
+buffer * buf_getstringbuf(buffer *buf) {
+ buffer *ret;
+ unsigned char* str;
+ unsigned int len;
+ str = buf_getstring(buf, &len);
+ ret = m_malloc(sizeof(*ret));
+ ret->data = str;
+ ret->len = len;
+ ret->size = len;
+ ret->pos = 0;
+ return ret;
+}
+
/* Just increment the buffer position the same as if we'd used buf_getstring,
* but don't bother copying/malloc()ing for it */
void buf_eatstring(buffer *buf) {