* patch #3966: Create a mh_xmalloc function to prevent mistakes when
[mmh] / uip / scan.c
index 1612717..3b56830 100644 (file)
@@ -14,6 +14,7 @@
 #include <h/scansbr.h>
 #include <h/tws.h>
 #include <h/mts.h>
+#include <h/utils.h>
 #include <errno.h>
 
 /*
@@ -51,7 +52,6 @@ static struct swit switches[] = {
     { NULL, 0 }
 };
 
-extern int errno;
 
 /*
  * global for sbr/formatsbr.c - yech!
@@ -97,8 +97,7 @@ main (int argc, char **argv)
      */
     nummsgs = 0;
     maxmsgs = MAXMSGS;
-    if (!(msgs = (char **) malloc ((size_t) (maxmsgs * sizeof(*msgs)))))
-       adios (NULL, "unable to allocate storage");
+    msgs = (char **) mh_xmalloc ((size_t) (maxmsgs * sizeof(*msgs)));
 
     /*
      * Parse arguments
@@ -320,7 +319,7 @@ main (int argc, char **argv)
 
            switch (state = scan (in, msgnum, 0, nfs, width,
                        msgnum == mp->curmsg, unseen,
-                       hdrflag ? folder : NULL, 0L, 1)) {
+                       folder, 0L, 1)) {
                case SCNMSG: 
                case SCNENC: 
                case SCNERR: