/**
* redraw_mix_line - Redraw the Mixmaster chain
* @param chain List of chain links
+ * @param rd Email and other compose data
*/
static void redraw_mix_line(struct ListHead *chain, struct ComposeRedrawData *rd)
{
}
/* If we have some previously decoded text, add it now */
- if (prev.data)
+ if (!mutt_buffer_is_empty(&prev))
{
finalize_chunk(&buf, &prev, prev_charset, prev_charsetlen);
}
/**
* serial_dump_buffer - Pack a Buffer into a binary blob
- * @param b Buffer to pack
+ * @param buf Buffer to pack
* @param d Binary blob to add to
* @param off Offset into the blob
* @param convert If true, the strings will be converted to utf-8
* @retval ptr End of the newly packed binary
*/
-unsigned char *serial_dump_buffer(struct Buffer *b, unsigned char *d, int *off, bool convert)
+unsigned char *serial_dump_buffer(struct Buffer *buf, unsigned char *d, int *off, bool convert)
{
- if (!b)
+ if (!buf)
{
d = serial_dump_int(0, d, off);
return d;
else
d = serial_dump_int(1, d, off);
- d = serial_dump_char_size(b->data, d, off, b->dsize + 1, convert);
- d = serial_dump_int(b->dptr - b->data, d, off);
- d = serial_dump_int(b->dsize, d, off);
+ d = serial_dump_char_size(buf->data, d, off, buf->dsize + 1, convert);
+ d = serial_dump_int(buf->dptr - buf->data, d, off);
+ d = serial_dump_int(buf->dsize, d, off);
return d;
}
/**
* serial_restore_buffer - Unpack a Buffer from a binary blob
- * @param[out] b Store the unpacked Buffer here
+ * @param[out] buf Store the unpacked Buffer here
* @param[in] d Binary blob to read from
* @param[out] off Offset into the blob
* @param[in] convert If true, the strings will be converted from utf-8
*/
-void serial_restore_buffer(struct Buffer *b, const unsigned char *d, int *off, bool convert)
+void serial_restore_buffer(struct Buffer *buf, const unsigned char *d, int *off, bool convert)
{
unsigned int used;
unsigned int offset;
return;
}
- serial_restore_char(&b->data, d, off, convert);
+ serial_restore_char(&buf->data, d, off, convert);
serial_restore_int(&offset, d, off);
- b->dptr = b->data + offset;
+ buf->dptr = buf->data + offset;
serial_restore_int(&used, d, off);
- b->dsize = used;
+ buf->dsize = used;
}
/**
unsigned char *serial_dump_address(struct Address *a, unsigned char *d, int *off, bool convert);
unsigned char *serial_dump_body(struct Body *c, unsigned char *d, int *off, bool convert);
-unsigned char *serial_dump_buffer(struct Buffer *b, unsigned char *d, int *off, bool convert);
+unsigned char *serial_dump_buffer(struct Buffer *buf, unsigned char *d, int *off, bool convert);
unsigned char *serial_dump_char(char *c, unsigned char *d, int *off, bool convert);
unsigned char *serial_dump_char_size(char *c, unsigned char *d, int *off, ssize_t size, bool convert);
unsigned char *serial_dump_envelope(struct Envelope *e, unsigned char *d, int *off, bool convert);
void serial_restore_address(struct Address **a, const unsigned char *d, int *off, bool convert);
void serial_restore_body(struct Body *c, const unsigned char *d, int *off, bool convert);
-void serial_restore_buffer(struct Buffer *b, const unsigned char *d, int *off, bool convert);
+void serial_restore_buffer(struct Buffer *buf, const unsigned char *d, int *off, bool convert);
void serial_restore_char(char **c, const unsigned char *d, int *off, bool convert);
void serial_restore_envelope(struct Envelope *e, const unsigned char *d, int *off, bool convert);
void serial_restore_int(unsigned int *i, const unsigned char *d, int *off);
imap_munge_mbox_name(adata->unicode, oldmbox, sizeof(oldmbox), oldname);
imap_munge_mbox_name(adata->unicode, newmbox, sizeof(newmbox), newname);
- struct Buffer *b = mutt_buffer_pool_get();
- mutt_buffer_printf(b, "RENAME %s %s", oldmbox, newmbox);
+ struct Buffer *buf = mutt_buffer_pool_get();
+ mutt_buffer_printf(buf, "RENAME %s %s", oldmbox, newmbox);
- if (imap_exec(adata, mutt_b2s(b), IMAP_CMD_NO_FLAGS) != IMAP_EXEC_SUCCESS)
+ if (imap_exec(adata, mutt_b2s(buf), IMAP_CMD_NO_FLAGS) != IMAP_EXEC_SUCCESS)
rc = -1;
- mutt_buffer_pool_release(&b);
+ mutt_buffer_pool_release(&buf);
return rc;
}
/**
* imap_fetch_msn_seqset - Generate a sequence set
- * @param[in] b Buffer for the result
+ * @param[in] buf Buffer for the result
* @param[in] adata Imap Account data
* @param[in] evalhc If true, check the Header Cache
* @param[in] msn_begin First Message Sequence Number
* Generates a more complicated sequence set after using the header cache,
* in case there are missing MSNs in the middle.
*/
-static unsigned int imap_fetch_msn_seqset(struct Buffer *b, struct ImapAccountData *adata,
+static unsigned int imap_fetch_msn_seqset(struct Buffer *buf, struct ImapAccountData *adata,
bool evalhc, unsigned int msn_begin,
unsigned int msn_end, unsigned int *fetch_msn_end)
{
unsigned int range_end = 0;
unsigned int msn_count = 0;
- mutt_buffer_reset(b);
+ mutt_buffer_reset(buf);
if (msn_end < msn_begin)
return 0;
*fetch_msn_end = msn_end;
else
*fetch_msn_end = msn_begin + max_headers_per_fetch - 1;
- mutt_buffer_printf(b, "%u:%u", msn_begin, *fetch_msn_end);
+ mutt_buffer_printf(buf, "%u:%u", msn_begin, *fetch_msn_end);
return (*fetch_msn_end - msn_begin + 1);
}
if (first_chunk)
first_chunk = false;
else
- mutt_buffer_addch(b, ',');
+ mutt_buffer_addch(buf, ',');
if (state == 1)
- mutt_buffer_add_printf(b, "%u", range_begin);
+ mutt_buffer_add_printf(buf, "%u", range_begin);
else if (state == 2)
- mutt_buffer_add_printf(b, "%u:%u", range_begin, range_end);
+ mutt_buffer_add_printf(buf, "%u:%u", range_begin, range_end);
state = 0;
- if ((mutt_buffer_len(b) > 500) || (msn_count >= max_headers_per_fetch))
+ if ((mutt_buffer_len(buf) > 500) || (msn_count >= max_headers_per_fetch))
break;
}
}
char tempfile[_POSIX_PATH_MAX];
FILE *fp = NULL;
struct ImapHeader h;
- struct Buffer *b = NULL;
+ struct Buffer *buf = NULL;
static const char *const want_headers =
"DATE FROM SENDER SUBJECT TO CC MESSAGE-ID REFERENCES CONTENT-TYPE "
"CONTENT-DESCRIPTION IN-REPLY-TO REPLY-TO LINES LIST-POST X-LABEL "
mutt_progress_init(&progress, _("Fetching message headers..."),
MUTT_PROGRESS_MSG, C_ReadInc, msn_end);
- b = mutt_buffer_pool_get();
+ buf = mutt_buffer_pool_get();
/* NOTE:
* The (fetch_msn_end < msn_end) used to be important to prevent
* cautious I'm keeping it.
*/
while ((fetch_msn_end < msn_end) &&
- imap_fetch_msn_seqset(b, adata, evalhc, msn_begin, msn_end, &fetch_msn_end))
+ imap_fetch_msn_seqset(buf, adata, evalhc, msn_begin, msn_end, &fetch_msn_end))
{
char *cmd = NULL;
mutt_str_asprintf(&cmd, "FETCH %s (UID FLAGS INTERNALDATE RFC822.SIZE %s)",
- mutt_b2s(b), hdrreq);
+ mutt_b2s(buf), hdrreq);
imap_cmd_start(adata, cmd);
FREE(&cmd);
bail:
mutt_buffer_pool_release(&hdr_list);
- mutt_buffer_pool_release(&b);
+ mutt_buffer_pool_release(&buf);
mutt_file_fclose(&fp);
FREE(&hdrreq);
rc = 0;
out:
- if (cmd.data)
- FREE(&cmd.data);
- if (sync_cmd.data)
- FREE(&sync_cmd.data);
+ FREE(&cmd.data);
+ FREE(&sync_cmd.data);
return (rc < 0) ? -1 : rc;
}
#ifdef USE_HCACHE
/**
* imap_msn_index_to_uid_seqset - Convert MSN index of UIDs to Seqset
- * @param b Buffer for the result
+ * @param buf Buffer for the result
* @param mdata Imap Mailbox data
*
* Generates a seqseq of the UIDs in msn_index to persist in the header cache.
* Empty spots are stored as 0.
*/
-static void imap_msn_index_to_uid_seqset(struct Buffer *b, struct ImapMboxData *mdata)
+static void imap_msn_index_to_uid_seqset(struct Buffer *buf, struct ImapMboxData *mdata)
{
int first = 1, state = 0;
unsigned int cur_uid = 0, last_uid = 0;
if (first)
first = 0;
else
- mutt_buffer_addch(b, ',');
+ mutt_buffer_addch(buf, ',');
if (state == 1)
- mutt_buffer_add_printf(b, "%u", range_begin);
+ mutt_buffer_add_printf(buf, "%u", range_begin);
else if (state == 2)
- mutt_buffer_add_printf(b, "%u:%u", range_begin, range_end);
+ mutt_buffer_add_printf(buf, "%u:%u", range_begin, range_end);
state = 1;
range_begin = cur_uid;
return -1;
/* The seqset is likely large. Preallocate to reduce reallocs */
- struct Buffer b = mutt_buffer_make(8192);
- imap_msn_index_to_uid_seqset(&b, mdata);
+ struct Buffer buf = mutt_buffer_make(8192);
+ imap_msn_index_to_uid_seqset(&buf, mdata);
- int rc = mutt_hcache_store_raw(mdata->hcache, "/UIDSEQSET", 10, b.data,
- mutt_buffer_len(&b) + 1);
- mutt_debug(LL_DEBUG3, "Stored /UIDSEQSET %s\n", b.data);
- mutt_buffer_dealloc(&b);
+ int rc = mutt_hcache_store_raw(mdata->hcache, "/UIDSEQSET", 10, buf.data,
+ mutt_buffer_len(&buf) + 1);
+ mutt_debug(LL_DEBUG3, "Stored /UIDSEQSET %s\n", buf.data);
+ mutt_buffer_dealloc(&buf);
return rc;
}
*/
static struct Buffer *buffer_new(void)
{
- struct Buffer *b = mutt_mem_malloc(sizeof(struct Buffer));
- mutt_buffer_init(b);
- return b;
+ struct Buffer *buf = mutt_mem_malloc(sizeof(struct Buffer));
+ mutt_buffer_init(buf);
+ return buf;
}
/**
tmp.subtype);
mutt_debug(LL_DEBUG1, "\"%s\" -> %s\n", b->filename, type);
}
- if (tmp.subtype)
- FREE(&tmp.subtype);
- if (tmp.xtype)
- FREE(&tmp.xtype);
+ FREE(&tmp.subtype);
+ FREE(&tmp.xtype);
}
}
}
if ((*quote_list)->down)
cleanup_quote(&((*quote_list)->down));
ptr = (*quote_list)->next;
- if ((*quote_list)->prefix)
- FREE(&(*quote_list)->prefix);
+ FREE(&(*quote_list)->prefix);
FREE(quote_list);
*quote_list = ptr;
}
regfree(&rd.search_re);
for (size_t i = 0; i < rd.last_line; i++)
{
- if (rd.line_info[i].search)
- FREE(&(rd.line_info[i].search));
+ FREE(&(rd.line_info[i].search));
rd.line_info[i].search_cnt = -1;
}
}
for (size_t i = 0; i < rd.max_line; i++)
{
/* cleanup */
- if (rd.line_info[i].search)
- FREE(&(rd.line_info[i].search));
+ FREE(&(rd.line_info[i].search));
rd.line_info[i].search_cnt = -1;
}
rd.search_flag = 0;