Annotation of parser3/src/lib/ltdl/libltdl/lt__alloc.h, revision 1.2
1.1 moko 1: /* lt__alloc.h -- internal memory management interface
2:
1.2 ! moko 3: Copyright (C) 2004, 2011-2019, 2021-2024 Free Software Foundation,
! 4: Inc.
1.1 moko 5: Written by Gary V. Vaughan, 2004
6:
7: NOTE: The canonical source of this file is maintained with the
8: GNU Libtool package. Report bugs to bug-libtool@gnu.org.
9:
10: GNU Libltdl is free software; you can redistribute it and/or
11: modify it under the terms of the GNU Lesser General Public
12: License as published by the Free Software Foundation; either
13: version 2 of the License, or (at your option) any later version.
14:
15: As a special exception to the GNU Lesser General Public License,
16: if you distribute this file as part of a program or library that
17: is built using GNU Libtool, you may include this file under the
18: same distribution terms that you use for the rest of that program.
19:
20: GNU Libltdl is distributed in the hope that it will be useful,
21: but WITHOUT ANY WARRANTY; without even the implied warranty of
22: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23: GNU Lesser General Public License for more details.
24:
25: You should have received a copy of the GNU Lesser General Public
1.2 ! moko 26: License along with GNU Libltdl. If not, see <https://www.gnu.org/licenses/>.
1.1 moko 27: */
28:
1.2 ! moko 29: #if !defined LT__ALLOC_H
1.1 moko 30: #define LT__ALLOC_H 1
31:
32: #include "lt_system.h"
33:
34: LT_BEGIN_C_DECLS
35:
36: #define MALLOC(tp, n) (tp*) lt__malloc((n) * sizeof(tp))
37: #define REALLOC(tp, mem, n) (tp*) lt__realloc((mem), (n) * sizeof(tp))
1.2 ! moko 38: #define FREE(mem) LT_STMT_START { \
! 39: free (mem); mem = NULL; } LT_STMT_END
! 40: #define MEMREASSIGN(p, q) LT_STMT_START { \
! 41: if ((p) != (q)) { free (p); (p) = (q); (q) = 0; } \
1.1 moko 42: } LT_STMT_END
43:
44: /* If set, this function is called when memory allocation has failed. */
45: LT_SCOPE void (*lt__alloc_die) (void);
46:
47: LT_SCOPE void *lt__malloc (size_t n);
48: LT_SCOPE void *lt__zalloc (size_t n);
49: LT_SCOPE void *lt__realloc (void *mem, size_t n);
50: LT_SCOPE void *lt__memdup (void const *mem, size_t n);
51:
52: LT_SCOPE char *lt__strdup (const char *string);
53:
54: LT_END_C_DECLS
55:
1.2 ! moko 56: #endif /*!defined LT__ALLOC_H*/
E-mail: