xref: /titanic_50/usr/src/cmd/fm/eversholt/common/alloc.h (revision 84f7a9b9dca4f23b5f50edef0e59d7eb44301114)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  *
26  * alloc.h -- public definitions for memory allocation module
27  *
28  */
29 
30 #ifndef	_ESC_COMMON_ALLOC_H
31 #define	_ESC_COMMON_ALLOC_H
32 
33 #pragma ident	"%Z%%M%	%I%	%E% SMI"
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 void alloc_init(void);
40 void alloc_fini(void);
41 void *alloc_realloc(void *ptr, size_t nbytes, const char *fname, int line);
42 void *alloc_malloc(size_t nbytes, const char *fname, int line);
43 void alloc_free(void *ptr, const char *fname, int line);
44 char *alloc_strdup(const char *ptr, const char *fname, int line);
45 
46 #define	MALLOC(nbytes) alloc_malloc(nbytes, __FILE__, __LINE__)
47 #define	REALLOC(ptr, nbytes) alloc_realloc(ptr, nbytes, __FILE__, __LINE__)
48 #define	FREE(ptr) alloc_free(ptr, __FILE__, __LINE__)
49 #define	STRDUP(ptr) alloc_strdup(ptr, __FILE__, __LINE__)
50 
51 #ifdef	__cplusplus
52 }
53 #endif
54 
55 #endif	/* _ESC_COMMON_ALLOC_H */
56