From bdb6c75fd667e43ce228f1a32e930a0f2966f29d Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 19 Feb 2024 14:53:05 -0800 Subject: Remove xpmstrdup fallback for strdup It has never been used in the autoconf builds Signed-off-by: Alan Coopersmith --- src/XpmI.h | 9 +-------- src/misc.c | 18 ------------------ src/scan.c | 10 +++++----- 3 files changed, 6 insertions(+), 31 deletions(-) diff --git a/src/XpmI.h b/src/XpmI.h index 69e23c2..3292a2c 100644 --- a/src/XpmI.h +++ b/src/XpmI.h @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -290,14 +291,6 @@ HFUNC(xpm_znormalizeimagebits, void, (register unsigned char *bp, #define ZINDEX1(x, y, img) ((y) * img->bytes_per_line) + ((x) >> 3) -#ifdef NEED_STRDUP -HFUNC(xpmstrdup, char *, (char *s1)); -#else -#undef xpmstrdup -#define xpmstrdup strdup -#include -#endif - HFUNC(xpmatoui, unsigned int, (char *p, unsigned int l, unsigned int *ui_return)); diff --git a/src/misc.c b/src/misc.c index e5bc0f6..5a26646 100644 --- a/src/misc.c +++ b/src/misc.c @@ -37,24 +37,6 @@ #endif #include "XpmI.h" -#ifdef NEED_STRDUP -/* - * in case strdup is not provided by the system here is one - * which does the trick - */ -char * -xpmstrdup(char *s1) -{ - char *s2; - size_t l = strlen(s1) + 1; - - if (s2 = (char *) XpmMalloc(l)) - strcpy(s2, s1); - return s2; -} - -#endif - unsigned int xpmatoui( register char *p, diff --git a/src/scan.c b/src/scan.c index 712f617..98c349c 100644 --- a/src/scan.c +++ b/src/scan.c @@ -362,13 +362,13 @@ ScanTransparentColor( /* end 3.2 bc */ for (key = 1; key <= NKEYS; key++) { if ((s = mask_defaults[key])) { - defaults[key] = (char *) xpmstrdup(s); + defaults[key] = strdup(s); if (!defaults[key]) return (XpmNoMemory); } } } else { - color->c_color = (char *) xpmstrdup(TRANSPARENT_COLOR); + color->c_color = strdup(TRANSPARENT_COLOR); if (!color->c_color) return (XpmNoMemory); } @@ -491,7 +491,7 @@ ScanOtherColors( found = True; for (key = 1; key <= NKEYS; key++) { if ((s = adefaults[key])) - defaults[key] = (char *) xpmstrdup(s); + defaults[key] = strdup(s); } } } @@ -502,13 +502,13 @@ ScanOtherColors( colorname = xpmGetRgbName(rgbn, rgbn_max, xcolor->red, xcolor->green, xcolor->blue); if (colorname) - color->c_color = (char *) xpmstrdup(colorname); + color->c_color = strdup(colorname); else { /* at last store the rgb value */ char buf[BUFSIZ]; sprintf(buf, "#%04X%04X%04X", xcolor->red, xcolor->green, xcolor->blue); - color->c_color = (char *) xpmstrdup(buf); + color->c_color = strdup(buf); } if (!color->c_color) { XpmFree(xcolors); -- cgit v1.2.3