From: Ralph Corderoy Date: Tue, 18 Oct 2016 12:37:14 +0000 (+0100) Subject: Replace getcpy() with mh_xstrdup() where the string isn't NULL. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/3bc058fd4a216b5eed88562eb3581a1fc766e613?ds=inline Replace getcpy() with mh_xstrdup() where the string isn't NULL. --- diff --git a/sbr/path.c b/sbr/path.c index 871ad22d..fca85229 100644 --- a/sbr/path.c +++ b/sbr/path.c @@ -70,13 +70,13 @@ expath (char *name, int flag) && strcmp (name, DOT) && strcmp (name, DOTDOT) && strncmp (name, PWD, NPWD)))) - return getcpy (name); + return mh_xstrdup(name); if (pwds == NULL) pwds = pwd (); if (strcmp (name, DOT) == 0 || strcmp (name, CWD) == 0) - return getcpy (pwds); + return mh_xstrdup(pwds); ep = pwds + strlen (pwds); if ((cp = strrchr(pwds, '/')) == NULL) @@ -90,7 +90,7 @@ expath (char *name, int flag) if (strcmp (name, DOTDOT) == 0 || strcmp (name, PWD) == 0) { snprintf (buffer, sizeof(buffer), "%.*s", (int)(cp - pwds), pwds); - return getcpy (buffer); + return mh_xstrdup(buffer); } if (strncmp (name, PWD, NPWD) == 0) @@ -99,7 +99,7 @@ expath (char *name, int flag) cp = ep; snprintf (buffer, sizeof(buffer), "%.*s/%s", (int)(cp - pwds), pwds, name); - return getcpy (buffer); + return mh_xstrdup(buffer); }