Mercurial > dropbear
comparison buffer.c @ 1912:8b4274d34fe8
Use buf_burn_free() instead of two calls
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 29 Mar 2022 23:47:30 +0800 |
parents | 290caf301a4f |
children |
comparison
equal
deleted
inserted
replaced
1911:ced53051e200 | 1912:8b4274d34fe8 |
---|---|
53 /* free the buffer's data and the buffer itself */ | 53 /* free the buffer's data and the buffer itself */ |
54 void buf_free(buffer* buf) { | 54 void buf_free(buffer* buf) { |
55 m_free(buf); | 55 m_free(buf); |
56 } | 56 } |
57 | 57 |
58 /* overwrite the contents of the buffer to clear it */ | 58 /* overwrite the contents of the buffer then free it */ |
59 void buf_burn(const buffer* buf) { | 59 void buf_burn_free(buffer* buf) { |
60 m_burn(buf->data, buf->size); | 60 m_burn(buf->data, buf->size); |
61 } | 61 m_free(buf); |
62 } | |
63 | |
62 | 64 |
63 /* resize a buffer, pos and len will be repositioned if required when | 65 /* resize a buffer, pos and len will be repositioned if required when |
64 * downsizing */ | 66 * downsizing */ |
65 buffer* buf_resize(buffer *buf, unsigned int newsize) { | 67 buffer* buf_resize(buffer *buf, unsigned int newsize) { |
66 if (newsize > BUF_MAX_SIZE) { | 68 if (newsize > BUF_MAX_SIZE) { |