X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fadt%2Fxmalloc.h;h=040040887d13df4fa2f8cd0ad95aa379ef7492a6;hb=0decb677fb069c9d47f5285f12fdb983dca7fdae;hp=942c3fff134c9c98c40eff99548d2a7ecffa3aab;hpb=fbcb96cc20a7b5d06136e4c70870e86173e658eb;p=libfirm diff --git a/ir/adt/xmalloc.h b/ir/adt/xmalloc.h index 942c3fff1..040040887 100644 --- a/ir/adt/xmalloc.h +++ b/ir/adt/xmalloc.h @@ -14,51 +14,16 @@ #ifndef _XMALLOC_H_ #define _XMALLOC_H_ -#include "host.h" +#include -/* Declare alloca() */ +/* xmalloc() & friends. */ -#ifdef __GNUC__ - /* @@@ on a true GNU system, this is defined by stdlib.h */ -# undef alloca -# define alloca(size) __builtin_alloca (size) -#else -# if HAVE_ALLOCA_H -# include -# else -# if defined(_AIX) && !defined(C_ALLOCA) - /* if your version of AIX chokes on this, use gcc @@@ or alloca.o */ - #pragma alloca -# else -# ifndef alloca /* predefined by HP cc +Olibcalls */ -void *alloca (); -# endif -# endif -# endif -#endif +void *xmalloc(size_t size); +void *xcalloc(size_t num, size_t size); +void *xrealloc(void *ptr, size_t size); +char *xstrdup(const char *str); +void free(void *ptr); -/* xmalloc() & friends. - - The macros set tmalloc_tag to __FILE__, the functions leave it - alone. Use the latter if you set it yourself. See tmalloc.c for - details. */ - -extern void *xmalloc (size_t); -extern void *xrealloc (void *, size_t); -extern char *xstrdup (const char *); -extern void xnomem (void); -extern void free (void *); - -# define xmalloc(size) (XMALLOC_TRACE (xmalloc) ((size))) -# define xrealloc(ptr, size) (XMALLOC_TRACE (xrealloc) ((ptr), (size))) -# define xstrdup(str) (XMALLOC_TRACE (xstrdup) ((str))) -# define xfree(ptr) (XMALLOC_TRACE free ((ptr))) - -#if defined(HAVE_GNU_MALLOC) && defined(DEBUG) -extern const char *tmalloc_tag; -# define XMALLOC_TRACE tmalloc_tag = __FILE__, -#else -# define XMALLOC_TRACE -#endif +#define xfree(ptr) free(ptr) #endif /* _XMALLOC_H_ */