]> diplodocus.org Git - nmh/blobdiff - uip/mhbuildsbr.c
Minimized message files reads in m_getfld() when the caller
[nmh] / uip / mhbuildsbr.c
index ec2c195a2c6a7ed85b05beb96e5718e24ac95531..c7164b32e457ac4c293c5caad9097007c26fe5d7 100644 (file)
@@ -163,7 +163,8 @@ build_mime (char *infile, int directives)
      * the new MIME message.
      */
     for (compnum = 1, state = FLD;;) {
-       switch (state = m_getfld (state, name, buf, sizeof(buf), in)) {
+       int bufsz = sizeof buf;
+       switch (state = m_getfld (state, name, buf, &bufsz, in)) {
        case FLD:
        case FLDPLUS:
        case FLDEOF:
@@ -179,8 +180,10 @@ build_mime (char *infile, int directives)
 
            /* ignore any Content-Type fields in the header */
            if (!mh_strcasecmp (name, TYPE_FIELD)) {
-               while (state == FLDPLUS)
-                   state = m_getfld (state, name, buf, sizeof(buf), in);
+               while (state == FLDPLUS) {
+                   bufsz = sizeof buf;
+                   state = m_getfld (state, name, buf, &bufsz, in);
+               }
                goto finish_field;
            }
 
@@ -190,7 +193,8 @@ build_mime (char *infile, int directives)
 
            /* if necessary, get rest of field */
            while (state == FLDPLUS) {
-               state = m_getfld (state, name, buf, sizeof(buf), in);
+               bufsz = sizeof buf;
+               state = m_getfld (state, name, buf, &bufsz, in);
                vp = add (buf, vp);     /* add to previous value */
            }