]> diplodocus.org Git - nmh/blobdiff - sbr/client.c
Replace getcpy() with mh_xstrdup() where the string isn't NULL.
[nmh] / sbr / client.c
index 7417ed54c06f0a40fad5aefdf9e8fd7dd0359966..997889639e71847261674f91bdb0ce0bd1894a5b 100644 (file)
@@ -25,7 +25,6 @@
 static char **client_brkstring (char *, char *, char *);
 static int client_brkany (char, char *);
 static char **client_copyip (char **, char **, int);
-static char *client_getcpy (char *);
 static void client_freelist(char **);
 
 
@@ -38,15 +37,15 @@ client (char *args, char *service, char *response, int len_response, int debug)
 
     ap = arguments;
     if (args != NULL && *args != 0) {
-       ap = client_copyip (client_brkstring (client_getcpy (args), " ", "\n"),
+       ap = client_copyip (client_brkstring (mh_xstrdup(args), " ", "\n"),
                ap, MAXARGS);
     } else {
        if (servers != NULL && *servers != 0)
-           ap = client_copyip (client_brkstring (client_getcpy (servers), " ", "\n"),
+           ap = client_copyip (client_brkstring (mh_xstrdup(servers), " ", "\n"),
                ap, MAXARGS);
     }
     if (ap == arguments) {
-       *ap++ = client_getcpy ("localhost");
+       *ap++ = mh_xstrdup("localhost");
        *ap = NULL;
     }
 
@@ -137,8 +136,8 @@ static char *broken[MAXARGS + 1];
 static char **
 client_brkstring (char *strg, char *brksep, char *brkterm)
 {
-    register int bi;
-    register char c, *sp;
+    int bi;
+    char c, *sp;
 
     sp = strg;
 
@@ -167,7 +166,7 @@ client_brkstring (char *strg, char *brksep, char *brkterm)
 static int
 client_brkany (char chr, char *strg)
 {
-    register char *sp;
+    char *sp;
 
     if (strg)
        for (sp = strg; *sp; sp++)
@@ -190,17 +189,3 @@ client_copyip (char **p, char **q, int len_q)
 
     return q;
 }
-
-
-static char *
-client_getcpy (char *str)
-{
-    char *cp;
-    size_t len;
-
-    len = strlen(str) + 1;
-    cp = mh_xmalloc(len);
-
-    memcpy (cp, str, len);
-    return cp;
-}