From e144ec9018cabd1d9904fb6d04382d2cf06ec3dc Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Tue, 27 May 2014 20:32:42 -0700 Subject: Replace uStringDup() with direct calls to strdup() strdup is available in Unix98 and later, so part of the X.Org base platform requirements. Signed-off-by: Alan Coopersmith --- psgeom.c | 6 +++--- utils.c | 14 -------------- utils.h | 5 ----- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/psgeom.c b/psgeom.c index 1265a5c..4ec1347 100644 --- a/psgeom.c +++ b/psgeom.c @@ -409,9 +409,9 @@ CrackXLFDName(const char *name, FontStuff *stuff) if ((name == NULL) || (stuff == NULL)) return False; if (name[0] == '-') - tmp = uStringDup(&name[1]); + tmp = strdup(&name[1]); else - tmp = uStringDup(name); + tmp = strdup(name); if (tmp == NULL) return False; stuff->foundry = tmp; @@ -1019,7 +1019,7 @@ PSDoodad(FILE *out, PSState *state, XkbDoodadPtr doodad) char *tmp, *buf, *end; int offset = (leading * 8 / 10); - tmp = buf = uStringDup(doodad->text.text); + tmp = buf = strdup(doodad->text.text); while (tmp != NULL) { end = strchr(tmp, '\n'); if (end != NULL) diff --git a/utils.c b/utils.c index b813863..2243c32 100644 --- a/utils.c +++ b/utils.c @@ -147,20 +147,6 @@ uInternalError(const char *s, ...) /***====================================================================***/ -#ifndef HAVE_STRDUP -char * -uStringDup(const char *str) -{ - char *rtrn; - - if (str == NULL) - return NULL; - rtrn = (char *) malloc(strlen(str) + 1); - strcpy(rtrn, str); - return rtrn; -} -#endif - #ifndef HAVE_STRCASECMP int uStrCaseCmp(const char *str1, const char *str2) diff --git a/utils.h b/utils.h index d9cf438..cbb55f9 100644 --- a/utils.h +++ b/utils.h @@ -99,11 +99,6 @@ extern void uInternalError(const char *s, ...); extern int uStrCaseCmp(const char * /* s1 */ , const char * /* s2 */); #endif -#ifdef HAVE_STRDUP -#define uStringDup(s1) (strdup(s1)) -#else -extern char *uStringDup(const char * /* s1 */); -#endif /***====================================================================***/ -- cgit v1.2.3