int rc;
int count = 0;
- if (! (cmd = mutt_buffer_init (NULL)))
+ if (! (cmd = mutt_buffer_new ()))
{
dprint (1, (debugfile, "imap_exec_msgset: unable to allocate buffer\n"));
return -1;
if (!idata)
return NULL;
- if (!(idata->cmdbuf = mutt_buffer_init (NULL)))
+ if (!(idata->cmdbuf = mutt_buffer_new ()))
FREE (&idata);
idata->cmdslots = ImapPipelineDepth + 2;
char *p = *s;
mbstate_t mbstate1, mbstate2;
- if (!(b = mutt_buffer_init (b)))
+ if (!(b = mutt_buffer_new ()))
return -1;
memset (&mbstate1, 0, sizeof (mbstate1));
memset (&mbstate2, 0, sizeof (mbstate2));
srccopy[n-1] = '\0';
/* prepare BUFFERs */
- srcbuf = mutt_buffer_from(NULL, srccopy);
+ srcbuf = mutt_buffer_from (srccopy);
srcbuf->dptr = srcbuf->data;
- word = mutt_buffer_init(NULL);
- command = mutt_buffer_init(NULL);
+ word = mutt_buffer_new ();
+ command = mutt_buffer_new ();
/* Iterate expansions across successive arguments */
do {
if (SleepTime > s)
sleep (SleepTime);
else if (s)
- sleep (s);
+ sleep(s);
+}
+
+/* creates and initializes a BUFFER */
+BUFFER *mutt_buffer_new(void) {
+ BUFFER *b;
+
+ b = safe_malloc(sizeof(BUFFER));
+
+ mutt_buffer_init(b);
+
+ return b;
}
/*
* Disregards the 'destroy' flag, which seems reserved for caller.
* This is bad, but there's no apparent protocol for it.
*/
-BUFFER * mutt_buffer_init(BUFFER *b)
-{
- if (!b)
- {
+BUFFER *mutt_buffer_init (BUFFER *b) {
+ if (!b) {
b = safe_malloc(sizeof(BUFFER));
if (!b)
- return NULL;
- }
- else
- {
+ return NULL ;
+ } else {
FREE(&b->data);
}
memset(b, 0, sizeof(BUFFER));
* Disregards the 'destroy' flag, which seems reserved for caller.
* This is bad, but there's no apparent protocol for it.
*/
-BUFFER * mutt_buffer_from(BUFFER *b, char *seed)
-{
+BUFFER *mutt_buffer_from (char *seed) {
+ BUFFER *b;
+
if (!seed)
return NULL;
- b = mutt_buffer_init(b);
- b->data = safe_strdup (seed);
- b->dsize = mutt_strlen (seed);
+ b = mutt_buffer_new ();
+ b->data = safe_strdup(seed);
+ b->dsize = mutt_strlen(seed);
b->dptr = (char *) b->data + b->dsize;
return b;
}
/* spam tag is new, and match expr is non-empty; copy */
else if (!e->spam && *buf)
{
- e->spam = mutt_buffer_from(NULL, buf);
+ e->spam = mutt_buffer_from (buf);
}
/* match expr is empty; plug in null string if no existing tag */
else if (!e->spam)
{
- e->spam = mutt_buffer_from(NULL, "");
+ e->spam = mutt_buffer_from("");
}
if (e->spam && e->spam->data)
void mutt_make_string_info (char *, size_t, const char *, struct hdr_format_info *, format_flag);
int mutt_extract_token (BUFFER *, BUFFER *, int);
+BUFFER *mutt_buffer_new (void);
BUFFER * mutt_buffer_init (BUFFER *);
-BUFFER * mutt_buffer_from (BUFFER *, char *);
+BUFFER * mutt_buffer_from (char *);
void mutt_buffer_free(BUFFER **);
int mutt_buffer_printf (BUFFER*, const char*, ...);
void mutt_buffer_add (BUFFER*, const char*, size_t);