Synchronized with documentations/db/credits.
[AROS.git] / tools / MetaMake / mem.h
blob1d31694d5b6243cffde3652d188008908c8f0d03
1 #ifndef __MMAKE_MEM_H
2 #define __MMAKE_MEM_H
4 /* MetaMake - A Make extension
5 Copyright © 1995-2004, The AROS Development Team. All rights reserved.
7 This file is part of MetaMake.
9 MetaMake is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
14 MetaMake is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with GNU CC; see the file COPYING. If not, write to
21 the Free Software Foundation, 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. */
24 #include <ctype.h>
25 #ifdef HAVE_SYS_TYPES_H
26 # include <sys/types.h>
27 #endif
29 /* Macros */
30 #define cfree(x) if (x) free (x)
31 #define SETSTR(str,val) \
32 cfree (str); \
33 str = val ? xstrdup (val) : NULL
35 #define xstrdup(str) _xstrdup(str,__FILE__,__LINE__)
36 #define xstrndup(str,len) _xstrndup(str,len,__FILE__,__LINE__)
37 #define xmalloc(size) _xmalloc(size,__FILE__,__LINE__)
38 #define xfree(ptr) _xfree(ptr,__FILE__,__LINE__)
39 #define new(x) ((x *) xmalloc (sizeof (x)))
41 char * _xstrdup (const char * str, const char * file, int line);
42 char * _xstrndup (const char * str, size_t len, const char * file, int line);
43 void * _xmalloc (size_t size, const char * file, int line);
44 void _xfree (void * ptr, const char * file, int line);
46 #endif /* __MMAKE_MEM_H */