From: Ralph Corderoy Date: Sun, 16 Oct 2016 23:22:23 +0000 (+0100) Subject: Use mh_xstrdup() instead of getcpy() for a string constant. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/3bd5ce286fa6983f3f3f9fda4ff7f2f96c2a22a2?ds=inline;hp=bc10b0cee78f7df5b7b2c6958a5a547f56bac4f5 Use mh_xstrdup() instead of getcpy() for a string constant. It cannot be NULL. --- diff --git a/sbr/arglist.c b/sbr/arglist.c index 37dcec09..0edfc8b8 100644 --- a/sbr/arglist.c +++ b/sbr/arglist.c @@ -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) diff --git a/sbr/crawl_folders.c b/sbr/crawl_folders.c index 004e8cf2..67de2a50 100644 --- a/sbr/crawl_folders.c +++ b/sbr/crawl_folders.c @@ -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); } diff --git a/sbr/refile.c b/sbr/refile.c index c675500f..43ad908e 100644 --- a/sbr/refile.c +++ b/sbr/refile.c @@ -9,6 +9,7 @@ */ #include +#include 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) { diff --git a/uip/install-mh.c b/uip/install-mh.c index a79793f5..ea4e876b 100644 --- a/uip/install-mh.c +++ b/uip/install-mh.c @@ -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; diff --git a/uip/mhbuildsbr.c b/uip/mhbuildsbr.c index e867824f..eca264c8 100644 --- a/uip/mhbuildsbr.c +++ b/uip/mhbuildsbr.c @@ -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"); } } diff --git a/uip/mhfixmsg.c b/uip/mhfixmsg.c index e9ed4fc9..eba84526 100644 --- a/uip/mhfixmsg.c +++ b/uip/mhfixmsg.c @@ -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, diff --git a/uip/mhparse.c b/uip/mhparse.c index 49c1aba6..059d112c 100644 --- a/uip/mhparse.c +++ b/uip/mhparse.c @@ -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"); } diff --git a/uip/mhshowsbr.c b/uip/mhshowsbr.c index 57ea7882..42484a87 100644 --- a/uip/mhshowsbr.c +++ b/uip/mhshowsbr.c @@ -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; diff --git a/uip/sendsbr.c b/uip/sendsbr.c index 74f7dae5..44f56bf4 100644 --- a/uip/sendsbr.c +++ b/uip/sendsbr.c @@ -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); } } diff --git a/uip/slocal.c b/uip/slocal.c index 6bbcde6a..71c67b1e 100644 --- a/uip/slocal.c +++ b/uip/slocal.c @@ -1163,7 +1163,7 @@ get_sender (char *envelope, char **sender) char buffer[BUFSIZ]; if (envelope == NULL) { - *sender = getcpy (""); + *sender = mh_xstrdup(""); return; }