Idź do dokumentacji tego pliku.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __EKG_XMALLOC_H
00022 #define __EKG_XMALLOC_H
00023
00024 #include <sys/types.h>
00025 #include <stddef.h>
00026 #include <stdarg.h>
00027
00028 #ifndef __USE_POSIX
00029 #define __USE_POSIX 1
00030 #endif
00031 #ifndef _XOPEN_SOURCE
00032 #define _XOPEN_SOURCE 600
00033 #endif
00034 #include <limits.h>
00035
00036 #define __(x) (x ? x : "(null)")
00037
00038
00039 #ifdef UNUSED
00040 #elif defined(__GNUC__)
00041 # define UNUSED(x) UNUSED_ ## x __attribute__((unused))
00042 #elif defined(__LCLINT__)
00043 # define UNUSED(x) x
00044 #else
00045 # define UNUSED(x) x
00046 #endif
00047
00048
00049 #ifndef HAVE_SOCKLEN_T
00050 typedef unsigned int socklen_t;
00051 #endif
00052
00053
00054 #ifndef PATH_MAX
00055 # ifdef MAX_PATH
00056 # define PATH_MAX MAX_PATH
00057 # else
00058 # ifdef _POSIX_PATH_MAX
00059 # define PATH_MAX _POSIX_PATH_MAX
00060 # else
00061 # define PATH_MAX 4096
00062 # endif
00063 # endif
00064 #endif
00065
00066 #ifndef EKG2_WIN32_NOFUNCTION
00067
00068 void ekg_oom_handler();
00069
00070 void *xcalloc(size_t nmemb, size_t size);
00071 void *xmalloc(size_t size);
00072 void xfree(void *ptr);
00073 void *xrealloc(void *ptr, size_t size);
00074 char *xstrdup(const char *s);
00075 size_t xstrnlen(const char *s, size_t n);
00076 char *xstrndup(const char *s, size_t n);
00077 char *utf8ndup(const char *s, size_t n);
00078 void *xmemdup(void *ptr, size_t size);
00079
00080 int xstrcasecmp(const char *s1, const char *s2);
00081 char *xstrcat(char *dest, const char *src);
00082 char *xstrchr(const char *s, int c);
00083 int xstrcmp(const char *s1, const char *s2);
00084 int xstrcoll(const char *s1, const char *s2);
00085 char *xstrcpy(char *dest, const char *src);
00086 size_t xstrcspn(const char *s, const char *reject);
00087 char *xstrfry(char *string);
00088 size_t xstrlen(const char *s);
00089 int xstrncasecmp_pl(const char *s1, const char *s2, size_t n);
00090 char *xstrncat(char *dest, const char *src, size_t n);
00091 int xstrncmp(const char *s1, const char *s2, size_t n);
00092 char *xstrncpy(char *dest, const char *src, size_t n);
00093 int xstrncasecmp(const char *s1, const char *s2, size_t n);
00094 char *xstrpbrk(const char *s, const char *accept);
00095 char *xstrrchr(const char *s, int c);
00096
00097
00098
00099 size_t xstrspn(const char *s, const char *accept);
00100 char *xstrstr(const char *haystack, const char *needle);
00101 char *xstrcasestr(const char *haystack, const char *needle);
00102 char *xstrtok(char *s, const char *delim);
00103 char *xindex(const char *s, int c);
00104 char *xrindex(const char *s, int c);
00105
00106 char *vsaprintf(const char *format, va_list ap);
00107
00108
00109 #ifdef __GNUC__
00110 char *saprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
00111 #else
00112 char *saprintf(const char *format, ...);
00113 #endif
00114 #endif
00115
00116
00117 #endif
00118
00119
00120
00121
00122
00123
00124
00125
00126