]> diplodocus.org Git - nmh/blobdiff - uip/mhparse.c
Don't `else' after goto. Simplify control flow.
[nmh] / uip / mhparse.c
index 49c1aba6f22359aceacfdcf64e7321caefbd6038..50bffcf6a2bacde389712125da66ece6eecf0e61 100644 (file)
@@ -1053,7 +1053,7 @@ InitText (CT ct)
     if (chset != NULL && !check_charset (chset, strlen (chset))) {
        snprintf (buffer, sizeof(buffer), "%s-charset-%s", invo_name, chset);
        if ((cp = context_find (buffer)))
     if (chset != NULL && !check_charset (chset, strlen (chset))) {
        snprintf (buffer, sizeof(buffer), "%s-charset-%s", invo_name, chset);
        if ((cp = context_find (buffer)))
-           ct->c_termproc = getcpy (cp);
+           ct->c_termproc = mh_xstrdup(cp);
     }
 
     return OK;
     }
 
     return OK;
@@ -1702,8 +1702,7 @@ size_encoding (CT ct)
     if (ce->ce_file) {
        if (stat (ce->ce_file, &st) != NOTOK)
            return (long) st.st_size;
     if (ce->ce_file) {
        if (stat (ce->ce_file, &st) != NOTOK)
            return (long) st.st_size;
-       else
-           return 0L;
+        return 0L;
     }
 
     if (ct->c_encoding == CE_EXTERNAL)
     }
 
     if (ct->c_encoding == CE_EXTERNAL)
@@ -2322,7 +2321,7 @@ openExternal (CT ct, CT cb, CE ce, char **file, int *fd)
     if (find_cache (ct, rcachesw, (int *) 0, cb->c_id,
                cachefile, sizeof(cachefile)) != NOTOK) {
        if ((ce->ce_fp = fopen (cachefile, "r"))) {
     if (find_cache (ct, rcachesw, (int *) 0, cb->c_id,
                cachefile, sizeof(cachefile)) != NOTOK) {
        if ((ce->ce_fp = fopen (cachefile, "r"))) {
-           ce->ce_file = getcpy (cachefile);
+           ce->ce_file = mh_xstrdup(cachefile);
            ce->ce_unlink = 0;
            goto ready_already;
        } else {
            ce->ce_unlink = 0;
            goto ready_already;
        } else {
@@ -2374,7 +2373,7 @@ openFile (CT ct, char **file)
        return NOTOK;
     }
 
        return NOTOK;
     }
 
-    ce->ce_file = getcpy (e->eb_name);
+    ce->ce_file = mh_xstrdup(e->eb_name);
     ce->ce_unlink = 0;
 
     if ((ce->ce_fp = fopen (ce->ce_file, "r")) == NULL) {
     ce->ce_unlink = 0;
 
     if ((ce->ce_fp = fopen (ce->ce_file, "r")) == NULL) {
@@ -2515,7 +2514,7 @@ openFTP (CT ct, char **file)
                  LocalName (1));
        pass = buffer;
     } else {
                  LocalName (1));
        pass = buffer;
     } else {
-       ruserpass (e->eb_site, &username, &password);
+       ruserpass (e->eb_site, &username, &password, 0);
        user = username;
        pass = password;
     }
        user = username;
        pass = password;
     }
@@ -2919,17 +2918,16 @@ readDigest (CT ct, char *cp)
             }
 
             return OK;
             }
 
             return OK;
-        } else {
-            if (debugsw) {
-                fprintf (stderr, "invalid MD5 digest (got %d octets)\n",
-                         (int) strlen ((char *) digest));
-            }
-
-            return NOTOK;
         }
         }
-    } else {
+        if (debugsw) {
+            fprintf (stderr, "invalid MD5 digest (got %d octets)\n",
+                     (int) strlen ((char *) digest));
+        }
+
         return NOTOK;
     }
         return NOTOK;
     }
+
+    return NOTOK;
 }
 
 
 }
 
 
@@ -3537,8 +3535,7 @@ bad_quote:
            }
 
            if (pp == NULL) {
            }
 
            if (pp == NULL) {
-               NEW(pp);
-               memset(pp, 0, sizeof(*pp));
+               NEW0(pp);
                pp->name = nameptr;
                pp->next = phead;
                phead = pp;
                pp->name = nameptr;
                pp->next = phead;
                phead = pp;
@@ -3548,8 +3545,7 @@ bad_quote:
             * Insert this into the section linked list
             */
 
             * Insert this into the section linked list
             */
 
-           NEW(sp);
-           memset(sp, 0, sizeof(*sp));
+           NEW0(sp);
            sp->value = valptr;
            sp->index = index;
            sp->len = len;
            sp->value = valptr;
            sp->index = index;
            sp->len = len;
@@ -3665,7 +3661,7 @@ content_charset (CT ct) {
 
     ret_charset = get_param(ct->c_ctinfo.ci_first_pm, "charset", '?', 0);
 
 
     ret_charset = get_param(ct->c_ctinfo.ci_first_pm, "charset", '?', 0);
 
-    return ret_charset ? ret_charset : getcpy ("US-ASCII");
+    return ret_charset ? ret_charset : mh_xstrdup("US-ASCII");
 }
 
 
 }
 
 
@@ -3896,13 +3892,13 @@ param_len(PM pm, int index, size_t valueoff, int *encode, int *cont,
         */
 
        if (! pm->pm_charset) {
         */
 
        if (! pm->pm_charset) {
-           pm->pm_charset = getcpy(write_charset_8bit());
+           pm->pm_charset = mh_xstrdup(write_charset_8bit());
            if (strcasecmp(pm->pm_charset, "US-ASCII") == 0)
                adios(NULL, "8-bit characters in parameter \"%s\", but "
                      "local character set is US-ASCII", pm->pm_name);
        }
        if (! pm->pm_lang)
            if (strcasecmp(pm->pm_charset, "US-ASCII") == 0)
                adios(NULL, "8-bit characters in parameter \"%s\", but "
                      "local character set is US-ASCII", pm->pm_name);
        }
        if (! pm->pm_lang)
-           pm->pm_lang = getcpy(NULL); /* Default to a blank lang tag */
+           pm->pm_lang = mh_xstrdup("");       /* Default to a blank lang tag */
 
        len++;          /* For the encoding marker */
        maxfit--;
 
        len++;          /* For the encoding marker */
        maxfit--;
@@ -4084,8 +4080,7 @@ add_param(PM *first, PM *last, char *name, char *value, int nocopy)
 {
     PM pm;
 
 {
     PM pm;
 
-    NEW(pm);
-    memset(pm, 0, sizeof(*pm));
+    NEW0(pm);
     pm->pm_name = nocopy ? name : getcpy(name);
     pm->pm_value = nocopy ? value : getcpy(value);
 
     pm->pm_name = nocopy ? name : getcpy(name);
     pm->pm_value = nocopy ? value : getcpy(value);
 
@@ -4139,8 +4134,7 @@ get_param(PM first, const char *name, char replace, int fetchonly)
        if (strcasecmp(name, first->pm_name) == 0) {
            if (fetchonly)
                return first->pm_value;
        if (strcasecmp(name, first->pm_name) == 0) {
            if (fetchonly)
                return first->pm_value;
-           else
-               return getcpy(get_param_value(first, replace));
+            return getcpy(get_param_value(first, replace));
        }
        first = first->pm_next;
     }
        }
        first = first->pm_next;
     }