This will allow preallocating buffers that we know are going to be
big for qresync support.
This will also be useful for buffer pools later on.
return b;
}
+
+/* Increases the allocated size of the buffer */
+void mutt_buffer_increase_size(struct Buffer *buf, size_t new_size)
+{
+ if (new_size > buf->dsize)
+ {
+ size_t offset = buf->dptr - buf->data;
+ buf->dsize = new_size;
+ mutt_mem_realloc(&buf->data, buf->dsize);
+ buf->dptr = buf->data + offset;
+ }
+}
struct Buffer *mutt_buffer_alloc(size_t size);
void mutt_buffer_free(struct Buffer **p);
struct Buffer *mutt_buffer_from(const char *seed);
+void mutt_buffer_increase_size(struct Buffer *buf, size_t new_size);
struct Buffer *mutt_buffer_init(struct Buffer *b);
bool mutt_buffer_is_empty(const struct Buffer *buf);
struct Buffer *mutt_buffer_new(void);