ekg2
|
00001 /* $Id: xmalloc.h 4520 2008-08-27 09:16:57Z peres $ */ 00002 00003 /* 00004 * (C) Copyright 2001-2002 Wojtek Kaniewski <wojtekka@irc.pl> 00005 * 2004 Piotr Kupisiewicz <deli@rzepaknet.us> 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License Version 2 as 00009 * published by the Free Software Foundation. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 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 #define EXPORTNOT __attribute__ ((visibility("hidden"))) 00029 00030 void *xcalloc(size_t nmemb, size_t size); 00031 void *xmalloc(size_t size); 00032 void *xmalloc2(size_t size); 00033 void xfree(void *ptr); 00034 void *xrealloc(void *ptr, size_t size); 00035 char *xstrdup(const char *s); 00036 char *xstrndup(const char *s, size_t n); 00037 void *xmemdup(void *ptr, size_t size); 00038 00039 int xstrcasecmp(const char *s1, const char *s2); 00040 char *xstrcat(char *dest, const char *src); 00041 char *xstrchr(const char *s, int c); 00042 int xstrcmp(const char *s1, const char *s2); 00043 char *xstrcpy(char *dest, const char *src); 00044 size_t xstrlen(const char *s); 00045 int xstrncasecmp_pl(const char *s1, const char *s2, size_t n); 00046 char *xstrncat(char *dest, const char *src, size_t n); 00047 int xstrncmp(const char *s1, const char *s2, size_t n); 00048 int xstrncasecmp(const char *s1, const char *s2, size_t n); 00049 char *xstrrchr(const char *s, int c); 00050 char *xstrstr(const char *haystack, const char *needle); 00051 char *xstrcasestr(const char *haystack, const char *needle); 00052 00053 char *vsaprintf(const char *format, va_list ap); 00054 00055 /* stuff.h */ 00056 #ifdef __GNUC__ 00057 char *saprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2))); 00058 #else 00059 char *saprintf(const char *format, ...); 00060 #endif 00061 00062 #endif /* __EKG_XMALLOC_H */ 00063 00064 /* 00065 * Local Variables: 00066 * mode: c 00067 * c-file-style: "k&r" 00068 * c-basic-offset: 8 00069 * indent-tabs-mode: t 00070 * End: 00071 */