21 #ifndef __EKG_XMALLOC_H
22 #define __EKG_XMALLOC_H
24 #include <sys/types.h>
30 #define __(x) (x ? x : "(null)")
34 #elif defined(__GNUC__)
35 # define UNUSED(x) UNUSED_ ## x __attribute__((unused))
36 #elif defined(__LCLINT__)
43 #ifndef HAVE_SOCKLEN_T
50 # define PATH_MAX MAX_PATH
52 # ifdef _POSIX_PATH_MAX
53 # define PATH_MAX _POSIX_PATH_MAX
55 # define PATH_MAX 4096
60 #ifndef EKG2_WIN32_NOFUNCTION
62 #ifndef EKG_NO_DEPRECATED
63 void *
xcalloc(
size_t nmemb,
size_t size);
65 void xfree(
void *ptr);
66 void *
xrealloc(
void *ptr,
size_t size);
68 char *
xstrndup(
const char *s,
size_t n);
70 char *
utf8ndup(
const char *s,
size_t n);
73 char *
xstrcat(
char *dest,
const char *src);
74 char *
xstrchr(
const char *s,
int c);
75 int xstrcmp(
const char *s1,
const char *s2);
76 int xstrcoll(
const char *s1,
const char *s2);
77 char *
xstrcpy(
char *dest,
const char *src);
78 size_t xstrcspn(
const char *s,
const char *reject);
81 char *
xstrncat(
char *dest,
const char *src,
size_t n);
82 int xstrncmp(
const char *s1,
const char *s2,
size_t n);
83 char *
xstrncpy(
char *dest,
const char *src,
size_t n);
84 int xstrncasecmp(
const char *s1,
const char *s2,
size_t n);
85 char *
xstrpbrk(
const char *s,
const char *accept);
86 char *
xstrrchr(
const char *s,
int c);
90 size_t xstrspn(
const char *s,
const char *accept);
91 char *
xstrstr(
const char *haystack,
const char *needle);
92 char *
xstrcasestr(
const char *haystack,
const char *needle);
93 char *
xstrtok(
char *s,
const char *delim);
94 char *
xindex(
const char *s,
int c);
95 char *
xrindex(
const char *s,
int c);
97 #ifndef EKG_NO_DEPRECATED
105 char *
saprintf(
const char *format, ...);