if (STAILQ_EMPTY(&a->mailboxes))
{
TAILQ_REMOVE(&AllAccounts, a, entries);
- if (a->adata)
+ if (a->free_adata)
a->free_adata(&a->adata);
FREE(&a);
}
*/
struct BodyCache *mutt_bcache_open(struct ConnAccount *account, const char *mailbox)
{
- struct BodyCache *bcache = NULL;
-
if (!account)
- goto bail;
+ return NULL;
- bcache = mutt_mem_calloc(1, sizeof(struct BodyCache));
+ struct BodyCache *bcache = mutt_mem_calloc(1, sizeof(struct BodyCache));
if (bcache_path(account, mailbox, bcache->path, sizeof(bcache->path)) < 0)
- goto bail;
- bcache->pathlen = mutt_str_strlen(bcache->path);
+ {
+ FREE(&bcache);
+ return NULL;
+ }
+ bcache->pathlen = mutt_str_strlen(bcache->path);
return bcache;
-
-bail:
- if (bcache)
- FREE(&bcache);
- return NULL;
}
/**
NI_WITHSCOPEID |
#endif
NI_NUMERICSERV);
- if (ret)
+ if (ret != 0)
return getnameinfo_err(ret);
if (outlen < strlen(hbuf) + strlen(pbuf) + 2)
*/
int mutt_socket_close(struct Connection *conn)
{
+ if (!conn)
+ return 0;
+
int rc = -1;
if (conn->fd < 0)
{
while (buflen-- > 0)
FREE(&buf[buflen]);
- if (buf)
- FREE(&buf);
+ FREE(&buf);
}
/**
mx_mbox_close(&tmpctx, NULL);
bail:
- if (fp)
- mutt_file_fclose(&fp);
+ mutt_file_fclose(&fp);
if (rc >= 0)
unlink(tmp);
*/
void mutt_body_free(struct Body **p)
{
+ if (!p)
+ return;
+
struct Body *a = *p, *b = NULL;
while (a)
mutt_email_free(&b->email);
}
- if (b->parts)
- mutt_body_free(&b->parts);
-
+ mutt_body_free(&b->parts);
FREE(&b);
}
else
bodyfile = tempfile;
- if (fin)
- mutt_file_fclose(&fin);
+ mutt_file_fclose(&fin);
}
FREE(&bodytext);
mutt_sb_set_open_mailbox();
#endif
mutt_index_menu();
- if (Context)
- mutt_context_free(&Context);
+ mutt_context_free(&Context);
}
#ifdef USE_IMAP
imap_logout_all();
*/
int mutt_file_fclose(FILE **f)
{
- int r = 0;
-
- if (*f)
- r = fclose(*f);
+ if (!f || !*f)
+ return 0;
+ int r = fclose(*f);
*f = NULL;
return r;
}
else
mutt_perror(fpin ? tempfile : a->filename);
- if (fpin)
- mutt_file_fclose(&fpin);
- if (fpout)
- mutt_file_fclose(&fpout);
+ mutt_file_fclose(&fpin);
+ mutt_file_fclose(&fpout);
return a->unlink ? 0 : -1;
}
*/
static void free_key(struct PgpKeyInfo **kpp)
{
- struct PgpKeyInfo *kp = NULL;
-
if (!kpp || !*kpp)
return;
- kp = *kpp;
+ struct PgpKeyInfo *kp = *kpp;
pgp_free_uid(&kp->address);
FREE(&kp->keyid);
r = q->next;
free_key(&q);
}
- if (p->parent)
- free_key(&p->parent);
+ free_key(&p->parent);
free_key(&p);
}
rc = 0;
break;
}
- if (fp)
- mutt_file_fclose(&fp);
+ mutt_file_fclose(&fp);
+
if (*tmpfile)
unlink(tmpfile);
return rc;
int cont = 0;
size_t buflen = 2 * LONG_STRING, off = 0, b = 0;
- if (adata->overview_fmt)
- FREE(&adata->overview_fmt);
+ FREE(&adata->overview_fmt);
adata->overview_fmt = mutt_mem_malloc(buflen);
while (true)
*/
void mutt_pattern_free(struct Pattern **pat)
{
+ if (!pat || !*pat)
+ return;
+
struct Pattern *tmp = NULL;
while (*pat)
FREE(&tmp->p.regex);
}
- if (tmp->child)
- mutt_pattern_free(&tmp->child);
+ mutt_pattern_free(&tmp->child);
FREE(&tmp);
}
}
{
/* drop previous limit pattern */
FREE(&Context->pattern);
- if (Context->limit_pattern)
- mutt_pattern_free(&Context->limit_pattern);
+ mutt_pattern_free(&Context->limit_pattern);
if (Context->mailbox->msg_count && !Context->mailbox->vcount)
mutt_error(_("No messages matched criteria"));
*/
void rfc1524_free_entry(struct Rfc1524MailcapEntry **entry)
{
+ if (!entry || !*entry)
+ return;
+
struct Rfc1524MailcapEntry *p = *entry;
FREE(&p->command);
else if (pid == -1)
{
unlink(msg);
- if (tempfile)
- FREE(tempfile);
+ FREE(tempfile);
_exit(S_ERR);
}
rc = 0;
} while (false);
- if (conn)
- mutt_socket_close(conn);
+ mutt_socket_close(conn);
if (rc == SMTP_ERR_READ)
mutt_error(_("SMTP session failed: read error"));