* @note Strips `\r` from `\r\n`.
* Apparently even literals use `\r\n`-terminated strings ?!
*/
-int imap_read_literal(FILE *fp, struct ImapAccountData *adata, unsigned long bytes,
- struct Progress *pbar)
+int imap_read_literal(FILE *fp, struct ImapAccountData *adata,
+ unsigned long bytes, struct Progress *pbar)
{
char c;
bool r = false;
*
* return cached mailbox stats or NULL if create is 0
*/
-struct ImapStatus *imap_mboxcache_get(struct ImapAccountData *adata, const char *mbox, bool create)
+struct ImapStatus *imap_mboxcache_get(struct ImapAccountData *adata,
+ const char *mbox, bool create)
{
struct ImapStatus *status = NULL;
struct ListNode *np = NULL;
static int mailbox_maildir_check_dir(struct Mailbox *mailbox, const char *dir_name,
bool check_new, bool check_stats)
{
- struct Buffer *path = NULL;
- struct Buffer *msgpath = NULL;
DIR *dirp = NULL;
struct dirent *de = NULL;
char *p = NULL;
int rc = 0;
struct stat sb;
- path = mutt_buffer_pool_get();
- msgpath = mutt_buffer_pool_get();
+ struct Buffer *path = mutt_buffer_pool_get();
+ struct Buffer *msgpath = mutt_buffer_pool_get();
mutt_buffer_printf(path, "%s/%s", mailbox->path, dir_name);
/* when $mail_check_recent is set, if the new/ directory hasn't been modified since
const char *subdir, int *count, struct Progress *progress)
{
struct dirent *de = NULL;
- struct Buffer *buf = NULL;
int rc = 0, is_old = 0;
struct Maildir *entry = NULL;
struct Email *e = NULL;
- buf = mutt_buffer_pool_get();
+ struct Buffer *buf = mutt_buffer_pool_get();
if (subdir)
{
char subdir[4];
char suffix[16];
int rc = 0;
- struct Buffer *path = NULL, *full = NULL;
if (mutt_file_fsync_close(&msg->fp))
{
suffix[0] = '\0';
/* construct a new file name. */
- path = mutt_buffer_pool_get();
- full = mutt_buffer_pool_get();
+ struct Buffer *path = mutt_buffer_pool_get();
+ struct Buffer *full = mutt_buffer_pool_get();
while (true)
{
mutt_buffer_printf(path, "%s/%lld.R%" PRIu64 ".%s%s", subdir, (long long) time(NULL),
static int maildir_sync_message(struct Context *ctx, int msgno)
{
struct Email *e = ctx->mailbox->hdrs[msgno];
- struct Buffer *newpath = NULL, *partpath = NULL, *fullpath = NULL, *oldpath = NULL;
+ struct Buffer *newpath = NULL;
+ struct Buffer *partpath = NULL;
+ struct Buffer *fullpath = NULL;
+ struct Buffer *oldpath = NULL;
char suffix[16];
int rc = 0;
mutt_buffer_strcpy(newpath, p);
- /* kill the previous flags. */
- if ((p = strchr(newpath->data, ':')) != NULL)
+ /* kill the previous flags */
+ p = strchr(newpath->data, ':');
+ if (p)
{
*p = '\0';
newpath->dptr = p; /* fix buffer up, just to be safe */
{
maildir_canon_filename(tunique, de->d_name);
- if (!mutt_str_strcmp(mutt_b2s(tunique), unique))
+ if (mutt_str_strcmp(mutt_b2s(tunique), unique) == 0)
{
mutt_buffer_printf(fname, "%s/%s/%s", folder, subfolder, de->d_name);
fp = fopen(mutt_b2s(fname), "r");
*/
FILE *maildir_open_find_message(const char *folder, const char *msg, char **newname)
{
- struct Buffer *unique = NULL;
-
static unsigned int new_hits = 0, cur_hits = 0; /* simple dynamic optimization */
- unique = mutt_buffer_pool_get();
+ struct Buffer *unique = mutt_buffer_pool_get();
maildir_canon_filename(unique, msg);
FILE *fp = md_open_find_message(folder, mutt_b2s(unique),
{
struct stat st_new; /* status of the "new" subdirectory */
struct stat st_cur; /* status of the "cur" subdirectory */
- struct Buffer *buf = NULL;
int changed = 0; /* bitmask representing which subdirectories
have changed. 0x1 = new, 0x2 = cur */
bool occult = false; /* messages were removed from the mailbox */
if (!CheckNew)
return 0;
- buf = mutt_buffer_pool_get();
+ struct Buffer *buf = mutt_buffer_pool_get();
mutt_buffer_printf(buf, "%s/new", ctx->mailbox->path);
if (stat(mutt_b2s(buf), &st_new) == -1)
{