]> diplodocus.org Git - nmh/commitdiff
Replace getcpy() with mh_xstrdup() where the string isn't NULL.
authorRalph Corderoy <ralph@inputplus.co.uk>
Tue, 18 Oct 2016 12:09:27 +0000 (13:09 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Tue, 18 Oct 2016 12:09:27 +0000 (13:09 +0100)
sbr/addrsbr.c
sbr/arglist.c
sbr/oauth.c

index bc93672..ab9ddff 100644 (file)
@@ -149,7 +149,7 @@ getm (char *str, char *dfhost, int dftype, char *eresult, size_t eresultsize)
     mp->m_next = NULL;
     mp->m_text = getcpy (str);
     if (pers)
-       mp->m_pers = getcpy (pers);
+       mp->m_pers = mh_xstrdup(pers);
 
     if (mbox == NULL) {
        mp->m_type = BADHOST;
@@ -157,19 +157,19 @@ getm (char *str, char *dfhost, int dftype, char *eresult, size_t eresultsize)
        mp->m_ingrp = ingrp;
        mp->m_gname = getcpy (grp);
        if (note)
-           mp->m_note = getcpy (note);
+           mp->m_note = mh_xstrdup(note);
        return mp;
     }
 
     if (host) {
        mp->m_mbox = getcpy (mbox);
-       mp->m_host = getcpy (host);
+       mp->m_host = mh_xstrdup(host);
        mp->m_type =
            strcasecmp (LocalName(0), mp->m_host) ? NETHOST : LOCALHOST;
     } else {
        if ((pp = strchr(mbox, '!'))) {
            *pp++ = '\0';
-           mp->m_mbox = getcpy (pp);
+           mp->m_mbox = mh_xstrdup(pp);
            mp->m_host = getcpy (mbox);
            mp->m_type = UUCPHOST;
        } else {
@@ -189,12 +189,12 @@ getm (char *str, char *dfhost, int dftype, char *eresult, size_t eresultsize)
        to support wild-card matching. */
 
     if (route)
-       mp->m_path = getcpy (route);
+       mp->m_path = mh_xstrdup(route);
     mp->m_ingrp = ingrp;
     if (grp)
-       mp->m_gname = getcpy (grp);
+       mp->m_gname = mh_xstrdup(grp);
     if (note)
-       mp->m_note = getcpy (note);
+       mp->m_note = mh_xstrdup(note);
 
     return mp;
 }
index 0edfc8b..68a26a2 100644 (file)
@@ -61,7 +61,7 @@ argsplit(char *command, char **file, int *argp)
     if (!space && !metachar) {
        argvarray[0] = getcpy(r1bindex(command, '/'));
        argvarray[1] = NULL;
-       *file = getcpy(command);
+       *file = mh_xstrdup(command);
        if (argp)
            *argp = 1;
        return argvarray;
@@ -74,20 +74,20 @@ argsplit(char *command, char **file, int *argp)
 
     if (space && !metachar) {
        char **split;
-       p = getcpy(command);
+       p = mh_xstrdup(command);
        split = brkstring(p, " \t", NULL);
        if (split[0] == NULL) {
            adios(NULL, "Invalid blank command found");
        }
-       argvarray[0] = getcpy(r1bindex(split[0], '/'));
+       argvarray[0] = mh_xstrdup(r1bindex(split[0], '/'));
        for (i = 1; split[i] != NULL; i++) {
            if (i > MAXARGS) {
                adios(NULL, "Command exceeded argument limit");
            }
-           argvarray[i] = getcpy(split[i]);
+           argvarray[i] = mh_xstrdup(split[i]);
        }
        argvarray[i] = NULL;
-       *file = getcpy(split[0]);
+       *file = mh_xstrdup(split[0]);
        if (argp)
            *argp = i;
        free(p);
@@ -113,7 +113,7 @@ argsplit(char *command, char **file, int *argp)
     *file = mh_xstrdup("/bin/sh");
     argvarray[0] = mh_xstrdup("sh");
     argvarray[1] = mh_xstrdup("-c");
-    argvarray[2] = getcpy(command);
+    argvarray[2] = mh_xstrdup(command);
     argvarray[2] = add(" \"$@\"", argvarray[2]);
     argvarray[3] = mh_xstrdup("/bin/sh");
     argvarray[4] = NULL;
index 7977586..2aedf82 100755 (executable)
@@ -366,7 +366,7 @@ mh_oauth_get_err_string(mh_oauth_ctx *ctx)
         base = "unknown error";
     }
     if (ctx->err_details == NULL) {
-        return ctx->err_formatted = getcpy(base);
+        return ctx->err_formatted = mh_xstrdup(base);
     }
 
     ctx->err_formatted = concat(base, ": ", ctx->err_details, NULL);