X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Fmhbuild.c;h=ca7c5bf83aae362daaa36f18e65ce94680cf6a06;hp=d636cf7c7d069133e4ceeb1059ba24be5ee7b8ae;hb=b78007de9802005825390bee71dfce2306b42519;hpb=0595979e1f0514b3da28762f336b3b9ac9eec5c5 diff --git a/uip/mhbuild.c b/uip/mhbuild.c index d636cf7..ca7c5bf 100644 --- a/uip/mhbuild.c +++ b/uip/mhbuild.c @@ -319,6 +319,7 @@ build_mime(char *infile) struct part **pp; CT ct; FILE *in; + HF hp; umask(~m_gmprot()); @@ -329,8 +330,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 = mh_xcalloc(1, sizeof(*ct)); /* ** Allocate structure for handling decoded content @@ -348,7 +348,6 @@ build_mime(char *infile) switch (state = m_getfld(state, name, buf, sizeof(buf), in)) { case FLD: case FLDPLUS: - case FLDEOF: compnum++; /* abort if draft has Mime-Version header field */ @@ -367,7 +366,7 @@ build_mime(char *infile) while (state == FLDPLUS) state = m_getfld(state, name, buf, sizeof(buf), in); - goto finish_field; + continue; } /* get copies of the buffers */ @@ -384,18 +383,13 @@ build_mime(char *infile) /* Now add the header data to the list */ add_header(ct, np, vp); -finish_field: - /* if this wasn't the last hdr field, then continue */ - if (state != FLDEOF) - continue; - /* else fall... */ + continue; case FILEEOF: adios(EX_CONFIG, NULL, "draft has empty body -- no directives!"); /* NOTREACHED */ case BODY: - case BODYEOF: fseek(in, (long) (-strlen(buf)), SEEK_CUR); break; @@ -411,11 +405,9 @@ finish_field: } /* - * Iterate through the list of headers and call the function to MIME-ify - * them if required. - */ - - HF hp; + ** Iterate through the list of headers and call the function to + ** MIME-ify them if required. + */ for (hp = ct->c_first_hf; hp != NULL; hp = hp->next) { if (encode_rfc2047(hp->name, &hp->value, NULL)) { adios(EX_DATAERR, NULL, "Unable to encode header \"%s\"", hp->name); @@ -442,8 +434,7 @@ finish_field: 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 = mh_xcalloc(1, sizeof(*m)); ct->c_ctparams = (void *) m; pp = &m->mp_parts; @@ -462,8 +453,7 @@ finish_field: if (!p) continue; - if ((part = (struct part *) mh_xcalloc(1, sizeof(*part))) == NULL) - adios(EX_OSERR, NULL, "out of memory"); + part = mh_xcalloc(1, sizeof(*part)); *pp = part; pp = &part->mp_next; part->mp_part = p; @@ -543,8 +533,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 = mh_xcalloc(1, sizeof(*ce)); ct->c_cefile = ce; ct->c_ceopenfnx = open7Bit; /* since unencoded */ @@ -604,8 +593,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 = mh_xcalloc(1, sizeof(*ct)); *ctp = ct; /* allocate basic structure for handling decoded content */ @@ -913,9 +901,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 = mh_xcalloc(1, sizeof(*m)); ct->c_ctparams = (void *) m; pp = &m->mp_parts; @@ -925,9 +911,7 @@ use_forw: CT p; CE pe; - if ((p = (CT) mh_xcalloc(1, sizeof(*p))) - == NULL) - adios(EX_OSERR, NULL, "out of memory"); + p = mh_xcalloc(1, sizeof(*p)); init_decoded_content(p); pe = p->c_cefile; if (get_ctinfo("message/rfc822", p, 0) @@ -941,8 +925,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 = mh_xcalloc(1, sizeof(*part)); *pp = part; pp = &part->mp_next; part->mp_part = p; @@ -1001,8 +984,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 = mh_xcalloc(1, sizeof(*m)); ct->c_ctparams = (void *) m; pp = &m->mp_parts; @@ -1018,9 +1000,7 @@ use_forw: if (!p) continue; - if ((part = (struct part *) - mh_xcalloc(1, sizeof(*part))) == NULL) - adios(EX_OSERR, NULL, "out of memory"); + part = mh_xcalloc(1, sizeof(*part)); *pp = part; pp = &part->mp_next; part->mp_part = p;