Mercurial > dropbear
comparison buffer.c @ 551:c3f2ec71e3d4 agent-client
New standard linked list to use, rather than adhoc SignKeyList or TCPFwdList
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Mon, 06 Jul 2009 12:59:13 +0000 |
parents | c5d3ef11155f |
children | a98a2138364a |
comparison
equal
deleted
inserted
replaced
550:61c3513825b0 | 551:c3f2ec71e3d4 |
---|---|
221 ret[len] = '\0'; | 221 ret[len] = '\0'; |
222 | 222 |
223 return ret; | 223 return ret; |
224 } | 224 } |
225 | 225 |
226 /* Return a string as a newly allocated buffer */ | |
227 buffer * buf_getstringbuf(buffer *buf) { | |
228 buffer *ret; | |
229 unsigned char* str; | |
230 unsigned int len; | |
231 str = buf_getstring(buf, &len); | |
232 ret = m_malloc(sizeof(*ret)); | |
233 ret->data = str; | |
234 ret->len = len; | |
235 ret->size = len; | |
236 ret->pos = 0; | |
237 return ret; | |
238 } | |
239 | |
226 /* Just increment the buffer position the same as if we'd used buf_getstring, | 240 /* Just increment the buffer position the same as if we'd used buf_getstring, |
227 * but don't bother copying/malloc()ing for it */ | 241 * but don't bother copying/malloc()ing for it */ |
228 void buf_eatstring(buffer *buf) { | 242 void buf_eatstring(buffer *buf) { |
229 | 243 |
230 buf_incrpos( buf, buf_getint(buf) ); | 244 buf_incrpos( buf, buf_getint(buf) ); |