]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: buffer - Add buffer_clear()
authorStephan Bosch <stephan.bosch@open-xchange.com>
Sat, 29 Oct 2022 20:21:10 +0000 (22:21 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 27 Jan 2023 09:34:54 +0000 (09:34 +0000)
For completeness with respect to the next commit.

src/lib/buffer.h

index 0f173022b7c803dabcdcfb0deb191388e1b99402..f6c26df93abd788cd876bf6e7eb1955da4080ad4 100644 (file)
@@ -111,6 +111,12 @@ void *buffer_get_modifiable_data(const buffer_t *buf, size_t *used_size_r)
    the contents. */
 void buffer_set_used_size(buffer_t *buf, size_t used_size);
 
+/* Clear the buffer. */
+static inline void buffer_clear(buffer_t *buf)
+{
+       buffer_set_used_size(buf, 0);
+}
+
 /* Returns the current buffer size. */
 size_t buffer_get_size(const buffer_t *buf) ATTR_PURE;
 /* Returns how many bytes we can write to buffer without increasing its size.