X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=xmalloc.c;h=6107564d93eb51731e966c89eec8c396e7fed3b8;hb=40fe452223b5cc0ff5dbae0efa8551d7e96c1a5c;hp=c2ca4a66e932a32d99716d851914b13ca05da6f0;hpb=54b3b4b7e92fe237942a78c374ca2d57465719b9;p=~andy%2Ffetchmail diff --git a/xmalloc.c b/xmalloc.c index c2ca4a66..6107564d 100644 --- a/xmalloc.c +++ b/xmalloc.c @@ -10,25 +10,16 @@ #include #include #include -#if defined(STDC_HEADERS) #include -#endif #include "fetchmail.h" -#include "i18n.h" +#include "gettext.h" -#if defined(HAVE_VOIDPOINTER) -#define XMALLOCTYPE void -#else -#define XMALLOCTYPE char -#endif - -XMALLOCTYPE * -xmalloc (size_t n) +void *xmalloc (size_t n) { - XMALLOCTYPE *p; + void *p; - p = (XMALLOCTYPE *) malloc(n); - if (p == (XMALLOCTYPE *) 0) + p = (void *) malloc(n); + if (p == (void *) 0) { report(stderr, GT_("malloc failed\n")); abort(); @@ -36,13 +27,12 @@ xmalloc (size_t n) return(p); } -XMALLOCTYPE * -xrealloc (XMALLOCTYPE *p, size_t n) +void *xrealloc (void *p, size_t n) { if (p == 0) return xmalloc (n); - p = (XMALLOCTYPE *) realloc(p, n); - if (p == (XMALLOCTYPE *) 0) + p = (void *) realloc(p, n); + if (p == (void *) 0) { report(stderr, GT_("realloc failed\n")); abort(); @@ -58,17 +48,6 @@ char *xstrdup(const char *s) return p; } -#if !defined(HAVE_STRDUP) -char *strdup(const char *s) -{ - char *p; - p = (char *) malloc(strlen(s)+1); - if (p) - strcpy(p,s); - return p; -} -#endif /* !HAVE_STRDUP */ - char *xstrndup(const char *s, size_t len) { char *p; @@ -81,4 +60,5 @@ char *xstrndup(const char *s, size_t len) return p; } + /* xmalloc.c ends here */