]> granicus.if.org Git - mutt/commitdiff
Remove mutt_buffer_new() NULL retval checks.
authorKevin McCarthy <kevin@8t8.us>
Mon, 21 May 2018 22:12:47 +0000 (15:12 -0700)
committerKevin McCarthy <kevin@8t8.us>
Mon, 21 May 2018 22:12:47 +0000 (15:12 -0700)
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.

imap/imap.c
imap/util.c
mbyte.c

index 668203b8e9c09127b018664e5c7567e9b9283d84..64d2f10bcf8e3c2ad4cec54a5019a25b7c6ff625 100644 (file)
@@ -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
index 914c93c3c965bb12641e933b260baeb4cabbb933..e7393659ec550de0f8d4fd1ddaddc8632a7a8bb1 100644 (file)
@@ -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 0eedaa7ce7241de74cdf7ebf246e1fd11305dd88..b4df70a607594eea80e4dd6145e3a391e813517c 100644 (file)
--- 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)