summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2018-05-21 15:12:47 -0700
committerKevin McCarthy <kevin@8t8.us>2018-05-21 15:12:47 -0700
commit63cb8a0a99477493bf9afb832b5a6cbdc7a792fb (patch)
treeb689fe500bc832f9a7e533d66a03ffc52d0a997d
parenta001b1d3400651d4a32812f86314e1de0f635388 (diff)
Remove mutt_buffer_new() NULL retval checks.
It will fail, rather than return NULL. Further clean up imap_new_data() since it also had NULL checks for safe_calloc() that shouldn't happen.
-rw-r--r--imap/imap.c6
-rw-r--r--imap/util.c16
-rw-r--r--mbyte.c3
3 files changed, 5 insertions, 20 deletions
diff --git a/imap/imap.c b/imap/imap.c
index 668203b8..64d2f10b 100644
--- a/imap/imap.c
+++ b/imap/imap.c
@@ -1017,11 +1017,7 @@ int imap_exec_msgset (IMAP_DATA* idata, const char* pre, const char* post,
int rc;
int count = 0;
- if (! (cmd = mutt_buffer_new ()))
- {
- dprint (1, (debugfile, "imap_exec_msgset: unable to allocate buffer\n"));
- return -1;
- }
+ cmd = mutt_buffer_new ();
/* We make a copy of the headers just in case resorting doesn't give
exactly the original order (duplicate messages?), because other parts of
diff --git a/imap/util.c b/imap/util.c
index 914c93c3..e7393659 100644
--- a/imap/util.c
+++ b/imap/util.c
@@ -364,24 +364,14 @@ void imap_error (const char *where, const char *msg)
mutt_sleep (2);
}
-/* imap_new_idata: Allocate and initialise a new IMAP_DATA structure.
- * Returns NULL on failure (no mem) */
+/* imap_new_idata: Allocate and initialise a new IMAP_DATA structure. */
IMAP_DATA* imap_new_idata (void)
{
IMAP_DATA* idata = safe_calloc (1, sizeof (IMAP_DATA));
- if (!idata)
- return NULL;
-
- if (!(idata->cmdbuf = mutt_buffer_new ()))
- FREE (&idata);
-
+ idata->cmdbuf = mutt_buffer_new ();
idata->cmdslots = ImapPipelineDepth + 2;
- if (!(idata->cmds = safe_calloc(idata->cmdslots, sizeof(*idata->cmds))))
- {
- mutt_buffer_free(&idata->cmdbuf);
- FREE (&idata);
- }
+ idata->cmds = safe_calloc (idata->cmdslots, sizeof(*idata->cmds));
return idata;
}
diff --git a/mbyte.c b/mbyte.c
index 0eedaa7c..b4df70a6 100644
--- a/mbyte.c
+++ b/mbyte.c
@@ -549,8 +549,7 @@ int mutt_filter_unprintable (char **s)
char *p = *s;
mbstate_t mbstate1, mbstate2;
- if (!(b = mutt_buffer_new ()))
- return -1;
+ b = mutt_buffer_new ();
memset (&mbstate1, 0, sizeof (mbstate1));
memset (&mbstate2, 0, sizeof (mbstate2));
for (; (k = mbrtowc (&wc, p, MB_LEN_MAX, &mbstate1)); p += k)