]> diplodocus.org Git - nmh/commitdiff
Use mh_xstrdup() instead of getcpy() for a string constant.
authorRalph Corderoy <ralph@inputplus.co.uk>
Sun, 16 Oct 2016 23:22:23 +0000 (00:22 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Sun, 16 Oct 2016 23:22:23 +0000 (00:22 +0100)
It cannot be NULL.

sbr/arglist.c
sbr/crawl_folders.c
sbr/refile.c
uip/install-mh.c
uip/mhbuildsbr.c
uip/mhfixmsg.c
uip/mhparse.c
uip/mhshowsbr.c
uip/sendsbr.c
uip/slocal.c

index 37dcec093ce3115ceb497cb0c7f41def001bf1f9..0edfc8b80a5cb1b97e19ee6c3ad68ca27b607ada 100644 (file)
@@ -110,12 +110,12 @@ argsplit(char *command, char **file, int *argp)
      *   So we put in a dummy argument (we just use /bin/sh)
      */
 
-    *file = getcpy("/bin/sh");
-    argvarray[0] = getcpy("sh");
-    argvarray[1] = getcpy("-c");
+    *file = mh_xstrdup("/bin/sh");
+    argvarray[0] = mh_xstrdup("sh");
+    argvarray[1] = mh_xstrdup("-c");
     argvarray[2] = getcpy(command);
     argvarray[2] = add(" \"$@\"", argvarray[2]);
-    argvarray[3] = getcpy("/bin/sh");
+    argvarray[3] = mh_xstrdup("/bin/sh");
     argvarray[4] = NULL;
 
     if (argp)
index 004e8cf2f4b545212a7ebf7dad338be716d5bcd0..67de2a507feeb2b8fdef1df11d5f532603ffa6cf 100644 (file)
@@ -66,7 +66,7 @@ add_children (char *name, struct crawl_context *crawl)
     }
 
     if (strcmp (name, ".") == 0) {
-       prefix = getcpy ("");
+       prefix = mh_xstrdup("");
     } else {
        prefix = concat (name, "/", (void *)NULL);
     }
index c675500f45bd9122f619dcbc6c303600bcd88bdb..43ad908e1b61faa4d4a937ceeec3bca348a05d4f 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 #include <h/mh.h>
+#include <h/utils.h>
 
 
 int
@@ -21,9 +22,9 @@ refile (char **arg, char *file)
 
     vec = argsplit(fileproc, &program, &vecp);
 
-    vec[vecp++] = getcpy("-nolink");   /* override bad .mh_profile defaults */
-    vec[vecp++] = getcpy("-nopreserve");
-    vec[vecp++] = getcpy("-file");
+    vec[vecp++] = mh_xstrdup("-nolink"); /* override bad .mh_profile defaults */
+    vec[vecp++] = mh_xstrdup("-nopreserve");
+    vec[vecp++] = mh_xstrdup("-file");
     vec[vecp++] = getcpy(file);
 
     if (arg) {
index a79793f5a36ce613474e8fdcbd75ee172b457254..ea4e876b752527de0bf6dc59d69cbc1bd545a0b1 100644 (file)
@@ -182,7 +182,7 @@ query:
      */
     NEW(np);
     m_defs = np;
-    np->n_name = getcpy ("Path");
+    np->n_name = mh_xstrdup("Path");
     np->n_field = getcpy (pathname);
     np->n_context = 0;
     np->n_next = NULL;
index e867824fce100f95681f6db789cd5532ab0cba89..eca264c887ea16b58421735ee622fceff2648c02 100644 (file)
@@ -510,7 +510,7 @@ finish_field:
         * So this seems like the best option available since we're going
         * to call scan_content() on this.
         */
-       p->c_cefile.ce_file = getcpy("/dev/null");
+       p->c_cefile.ce_file = mh_xstrdup("/dev/null");
        p->c_begin = ftell(in);
        p->c_end = ftell(in);
 
@@ -2067,7 +2067,7 @@ set_disposition (CT ct) {
                       cp);
         }
 
-        ct->c_dispo_type = cp  ?  getcpy (cp)  :  getcpy ("attachment");
+        ct->c_dispo_type = cp  ?  getcpy (cp) : mh_xstrdup("attachment");
     }
 }
 
index e9ed4fc91197a5c710c1bfa41f1fc6c90784cb3c..eba84526f20644453fee95c986f17c36f66b39fe 100644 (file)
@@ -1277,7 +1277,7 @@ ensure_text_plain (CT *ct, CT parent, int *message_mods, int replacetextplain) {
                         HF hf;
 
                         parent->c_subtype = MULTI_ALTERNATE;
-                        parent->c_ctinfo.ci_subtype = getcpy ("alternative");
+                        parent->c_ctinfo.ci_subtype = mh_xstrdup("alternative");
                         if (! replace_substring (&parent->c_ctline, "/related",
                                                  "/alternative")) {
                             advise (NULL,
index 49c1aba6f22359aceacfdcf64e7321caefbd6038..059d112cbdd9978b8b7325b11d681269a6dac786 100644 (file)
@@ -3665,7 +3665,7 @@ content_charset (CT ct) {
 
     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");
 }
 
 
index 57ea78820069096febd67b193a5a4b76aa21a2b9..42484a87269df725a8d35fd496a6ecd2aa5eb5e7 100644 (file)
@@ -206,9 +206,9 @@ DisplayMsgHeader (CT ct, char *form, int concatsw)
     char *file;
 
     vec = argsplit(mhlproc, &file, &vecp);
-    vec[vecp++] = getcpy("-form");
+    vec[vecp++] = mh_xstrdup("-form");
     vec[vecp++] = getcpy(form);
-    vec[vecp++] = getcpy("-nobody");
+    vec[vecp++] = mh_xstrdup("-nobody");
     vec[vecp++] = getcpy(ct->c_file);
 
     /*
@@ -216,9 +216,9 @@ DisplayMsgHeader (CT ct, char *form, int concatsw)
      * then just pass that along.
      */
     if (nomore || concatsw) {
-       vec[vecp++] = getcpy("-nomoreproc");
+       vec[vecp++] = mh_xstrdup("-nomoreproc");
     } else if (progsw) {
-       vec[vecp++] = getcpy("-moreproc");
+       vec[vecp++] = mh_xstrdup("-moreproc");
        vec[vecp++] = getcpy(progsw);
     }
     vec[vecp] = NULL;
index 74f7dae5c6787ffddf56cf513cfaced61b8a2a02..44f56bf4df7065efb736771d986d254b0c054ba2 100644 (file)
@@ -822,21 +822,21 @@ setup_oauth_params(char *vec[], int *vecp, const char *auth_svc,
                adios(NULL, "Unable to retrieve oauth profile entries: %s",
                      errbuf);
 
-           vec[(*vecp)++] = getcpy("-authservice");
+           vec[(*vecp)++] = mh_xstrdup("-authservice");
            vec[(*vecp)++] = getcpy(auth_svc);
-           vec[(*vecp)++] = getcpy("-oauthcredfile");
+           vec[(*vecp)++] = mh_xstrdup("-oauthcredfile");
            vec[(*vecp)++] = getcpy(mh_oauth_cred_fn(auth_svc));
-           vec[(*vecp)++] = getcpy("-oauthclientid");
+           vec[(*vecp)++] = mh_xstrdup("-oauthclientid");
            vec[(*vecp)++] = getcpy(svc.client_id);
-           vec[(*vecp)++] = getcpy("-oauthclientsecret");
+           vec[(*vecp)++] = mh_xstrdup("-oauthclientsecret");
            vec[(*vecp)++] = getcpy(svc.client_secret);
-           vec[(*vecp)++] = getcpy("-oauthauthendpoint");
+           vec[(*vecp)++] = mh_xstrdup("-oauthauthendpoint");
            vec[(*vecp)++] = getcpy(svc.auth_endpoint);
-           vec[(*vecp)++] = getcpy("-oauthredirect");
+           vec[(*vecp)++] = mh_xstrdup("-oauthredirect");
            vec[(*vecp)++] = getcpy(svc.redirect_uri);
-           vec[(*vecp)++] = getcpy("-oauthtokenendpoint");
+           vec[(*vecp)++] = mh_xstrdup("-oauthtokenendpoint");
            vec[(*vecp)++] = getcpy(svc.token_endpoint);
-           vec[(*vecp)++] = getcpy("-oauthscope");
+           vec[(*vecp)++] = mh_xstrdup("-oauthscope");
            vec[(*vecp)++] = getcpy(svc.scope);
         }
     }
index 6bbcde6a17c9bb8f328e4fe90ed4b60181468b99..71c67b1ea4aec6dcffb4064e98265abd168c4069 100644 (file)
@@ -1163,7 +1163,7 @@ get_sender (char *envelope, char **sender)
     char buffer[BUFSIZ];
 
     if (envelope == NULL) {
-       *sender = getcpy ("");
+       *sender = mh_xstrdup("");
        return;
     }