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 (BUFFER *buf, size_t new_size)
+{
+ size_t offset;
+
+ if (buf->dsize < new_size)
+ {
+ offset = buf->dptr - buf->data;
+ buf->dsize = new_size;
+ safe_realloc (&buf->data, buf->dsize);
+ buf->dptr = buf->data + offset;
+ }
+}
+
/*
* Creates and initializes a BUFFER*. If passed an existing BUFFER*,
* just initializes. Frees anything already in the buffer. Copies in
int mutt_extract_token (BUFFER *, BUFFER *, int);
BUFFER *mutt_buffer_new (void);
BUFFER * mutt_buffer_init (BUFFER *);
+void mutt_buffer_increase_size (BUFFER *, size_t);
BUFFER * mutt_buffer_from (char *);
void mutt_buffer_free(BUFFER **);
int mutt_buffer_printf (BUFFER*, const char*, ...);