add free_field as standard for struct field
[mmh] / uip / mhbuild.c
index 4f764f4..c4b1c60 100644 (file)
@@ -313,7 +313,7 @@ static CT
 build_mime(char *infile)
 {
        enum state state;
-       struct field f = {{0}};
+       struct field f = free_field;
        int compnum;
        char buf[BUFSIZ];
        char *cp, *np, *vp;
@@ -333,9 +333,7 @@ build_mime(char *infile)
        /*
        ** Allocate space for primary (outside) content
        */
-       if ((ct = (CT) mh_xcalloc(1, sizeof(*ct))) == NULL) {
-               adios(EX_OSERR, NULL, "out of memory");
-       }
+       ct = (CT) mh_xcalloc(1, sizeof(*ct));
 
        /*
        ** Allocate structure for handling decoded content
@@ -387,7 +385,7 @@ build_mime(char *infile)
 
                case LENERR2:
                case FMTERR2:
-               case ERR2:
+               case IOERR2:
                        adios(EX_CONFIG, NULL, "message format error in component #%d",
                                        compnum);
 
@@ -427,8 +425,7 @@ build_mime(char *infile)
        ct->c_subtype = MULTI_MIXED;
        ct->c_file = getcpy(infile);
 
-       if ((m = (struct multipart *) mh_xcalloc(1, sizeof(*m))) == NULL)
-               adios(EX_OSERR, NULL, "out of memory");
+       m = (struct multipart *) mh_xcalloc(1, sizeof(*m));
        ct->c_ctparams = (void *) m;
        pp = &m->mp_parts;
 
@@ -447,8 +444,7 @@ build_mime(char *infile)
                if (!p)
                        continue;
 
-               if ((part = (struct part *) mh_xcalloc(1, sizeof(*part))) == NULL)
-                       adios(EX_OSERR, NULL, "out of memory");
+               part = (struct part *) mh_xcalloc(1, sizeof(*part));
                *pp = part;
                pp = &part->mp_next;
                part->mp_part = p;
@@ -528,8 +524,7 @@ init_decoded_content(CT ct)
 {
        CE ce;
 
-       if ((ce = (CE) mh_xcalloc(1, sizeof(*ce))) == NULL)
-               adios(EX_OSERR, NULL, "out of memory");
+       ce = (CE) mh_xcalloc(1, sizeof(*ce));
 
        ct->c_cefile     = ce;
        ct->c_ceopenfnx  = open7Bit;  /* since unencoded */
@@ -589,8 +584,7 @@ user_content(FILE *in, char *file, char *buf, CT *ctp)
        }
 
        /* allocate basic Content structure */
-       if ((ct = (CT) mh_xcalloc(1, sizeof(*ct))) == NULL)
-               adios(EX_OSERR, NULL, "out of memory");
+       ct = (CT) mh_xcalloc(1, sizeof(*ct));
        *ctp = ct;
 
        /* allocate basic structure for handling decoded content */
@@ -898,9 +892,7 @@ use_forw:
                        ct->c_type = CT_MULTIPART;
                        ct->c_subtype = MULTI_DIGEST;
 
-                       if ((m = (struct multipart *)
-                                       mh_xcalloc(1, sizeof(*m))) == NULL)
-                               adios(EX_OSERR, NULL, "out of memory");
+                       m = (struct multipart *) mh_xcalloc(1, sizeof(*m));
                        ct->c_ctparams = (void *) m;
                        pp = &m->mp_parts;
 
@@ -910,9 +902,7 @@ use_forw:
                                        CT p;
                                        CE pe;
 
-                                       if ((p = (CT) mh_xcalloc(1, sizeof(*p)))
-                                                       == NULL)
-                                               adios(EX_OSERR, NULL, "out of memory");
+                                       p = (CT) mh_xcalloc(1, sizeof(*p));
                                        init_decoded_content(p);
                                        pe = p->c_cefile;
                                        if (get_ctinfo("message/rfc822", p, 0)
@@ -926,8 +916,7 @@ use_forw:
                                                        msgnum);
                                        pe->ce_file = getcpy(buffer);
 
-                                       if ((part = (struct part *) mh_xcalloc(1, sizeof(*part))) == NULL)
-                                               adios(EX_OSERR, NULL, "out of memory");
+                                       part = (struct part *) mh_xcalloc(1, sizeof(*part));
                                        *pp = part;
                                        pp = &part->mp_next;
                                        part->mp_part = p;
@@ -986,8 +975,7 @@ use_forw:
                ct->c_type = CT_MULTIPART;
                ct->c_subtype = vrsn;
 
-               if ((m = (struct multipart *) mh_xcalloc(1, sizeof(*m))) == NULL)
-                       adios(EX_OSERR, NULL, "out of memory");
+               m = (struct multipart *) mh_xcalloc(1, sizeof(*m));
                ct->c_ctparams = (void *) m;
 
                pp = &m->mp_parts;
@@ -1003,9 +991,7 @@ use_forw:
                        if (!p)
                                continue;
 
-                       if ((part = (struct part *)
-                                       mh_xcalloc(1, sizeof(*part))) == NULL)
-                               adios(EX_OSERR, NULL, "out of memory");
+                       part = (struct part *) mh_xcalloc(1, sizeof(*part));
                        *pp = part;
                        pp = &part->mp_next;
                        part->mp_part = p;