]> granicus.if.org Git - neomutt/commitdiff
tidy code
authorRichard Russon <rich@flatcap.org>
Wed, 17 Feb 2016 19:12:56 +0000 (19:12 +0000)
committerRichard Russon <rich@flatcap.org>
Mon, 4 Apr 2016 02:33:15 +0000 (03:33 +0100)
handler.c
pattern.c

index 307f747d186826deb85d6db8e322e53403fb93eb..60682914396d42874c77920d19d4c8af75ca8ee0 100644 (file)
--- a/handler.c
+++ b/handler.c
@@ -1626,8 +1626,8 @@ static int run_decode_and_handler (BODY *b, STATE *s, handler_t handler, int pla
       /* decode to a tempfile, saving the original destination */
       fp = s->fpout;
 #ifdef HAVE_FMEMOPEN
-     if ((s->fpout = open_memstream(&temp, &tempsize)) == NULL)
-     {
+     s->fpout = open_memstream (&temp, &tempsize);
+     if (!s->fpout) {
        mutt_error _("Unable to open memory stream!");
        dprint (1, (debugfile, "Can't open memory stream.\n"));
        return -1;
@@ -1670,13 +1670,14 @@ static int run_decode_and_handler (BODY *b, STATE *s, handler_t handler, int pla
       s->fpout = fp;
       fp = s->fpin;
 #ifdef HAVE_FMEMOPEN
-      if(tempsize)
-        s->fpin = fmemopen(temp, tempsize, "r");
-      else /* fmemopen cannot handle zero-length buffers */
+      if (tempsize) {
+        s->fpin = fmemopen (temp, tempsize, "r");
+      } else { /* fmemopen cannot handle zero-length buffers */
         s->fpin = safe_fopen ("/dev/null", "r");
-      if(s->fpin == NULL) {
-       mutt_perror("failed to re-open memstream!");
-       return (-1);
+      }
+      if (!s->fpin) {
+        mutt_perror ("failed to re-open memstream!");
+        return -1;
       }
 #else
       s->fpin = fopen (tempfile, "r");
@@ -1707,8 +1708,8 @@ static int run_decode_and_handler (BODY *b, STATE *s, handler_t handler, int pla
       /* restore the original source stream */
       safe_fclose (&s->fpin);
 #ifdef HAVE_FMEMOPEN
-      if(tempsize)
-          FREE(&temp);
+      if (tempsize)
+        FREE(&temp);
 #endif
       s->fpin = fp;
     }
index 13f0e203fe3566ad29456597f44a92a7f0b726e1..c170edebe03affb5f72654a69d7305aae9ca006a 100644 (file)
--- a/pattern.c
+++ b/pattern.c
@@ -169,10 +169,10 @@ msg_search (CONTEXT *ctx, pattern_t* pat, int msgno)
       s.fpin = msg->fp;
       s.flags = M_CHARCONV;
 #ifdef HAVE_FMEMOPEN
-      if((s.fpout = open_memstream(&temp, &tempsize)) == NULL)
-      {
+      s.fpout = open_memstream (&temp, &tempsize);
+      if (!s.fpout) {
        mutt_perror ("Error opening memstream");
-       return (0);
+       return 0;
       }
 #else
       mutt_mktemp (tempfile, sizeof (tempfile));
@@ -211,19 +211,21 @@ msg_search (CONTEXT *ctx, pattern_t* pat, int msgno)
       }
 
 #ifdef HAVE_FMEMOPEN
-      fclose(s.fpout);
+      fclose (s.fpout);
       lng = tempsize;
 
-      if(tempsize) {
-          if ((fp = fmemopen(temp, tempsize, "r")) == NULL) {
-            mutt_perror ("Error re-opening memstream");
-            return (0);
-          }
+      if (tempsize) {
+        fp = fmemopen (temp, tempsize, "r");
+        if (!fp) {
+          mutt_perror ("Error re-opening memstream");
+          return 0;
+        }
       } else { /* fmemopen cannot handle empty buffers */
-          if ((fp = safe_fopen ("/dev/null", "r")) == NULL) {
-            mutt_perror ("Error opening /dev/null");
-            return (0);
-          }
+        fp = safe_fopen ("/dev/null", "r");
+        if (!fp) {
+          mutt_perror ("Error opening /dev/null");
+          return 0;
+        }
       }
 #else
       fp = s.fpout;
@@ -279,8 +281,8 @@ msg_search (CONTEXT *ctx, pattern_t* pat, int msgno)
     {
       safe_fclose (&fp);
 #ifdef HAVE_FMEMOPEN
-      if(tempsize)
-          FREE (&temp);
+      if (tempsize)
+        FREE(&temp);
 #else
       unlink (tempfile);
 #endif