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
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.
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]
24 * Copyright (c) 1992, 1993, 2000 by Sun Microsystems, Inc.
25 * All rights reserved.
28 #pragma ident "%Z%%M% %I% %E% SMI"
35 #ifdef _DEBUG_MALLOC_INC
44 debug_free(file
, line
, p
);
47 #else /* ! _DEBUG_MALLOC_INC */
57 #endif /* ! _DEBUG_MALLOC_INC */
62 #ifdef _DEBUG_MALLOC_INC
73 mem
= debug_malloc(file
, line
, s
);
81 #else /* ! _DEBUG_MALLOC_INC */
90 if ((mem
= malloc(s
)) == NULL
) {
97 #endif /* ! _DEBUG_MALLOC_INC */
102 #ifdef _DEBUG_MALLOC_INC
111 return (memset(_Malloc(file
, line
, s
), 0, s
));
114 #else /* ! _DEBUG_MALLOC_INC */
121 return (memset(Malloc(s
), 0, s
));
124 #endif /* ! _DEBUG_MALLOC_INC */
129 #ifdef _DEBUG_MALLOC_INC
140 p
= debug_malloc(file
, line
, s
);
142 p
= debug_realloc(file
, line
, p
, s
);
150 #else /* ! _DEBUG_MALLOC_INC */
158 if ((p
= realloc(p
, s
)) == NULL
) {
165 #endif /* ! _DEBUG_MALLOC_INC */
170 #ifdef _DEBUG_MALLOC_INC
182 if (n
== 0 || s
== 0) {
185 total
= (unsigned long)n
* s
;
186 /* check for overflow */
190 return (_Zalloc(file
, line
, total
));
193 #else /* ! _DEBUG_MALLOC_INC */
203 if (n
== 0 || s
== 0) {
206 total
= (unsigned long)n
* s
;
207 /* check for overflow */
211 return (Zalloc(total
));
214 #endif /* ! _DEBUG_MALLOC_INC */
219 #ifdef _DEBUG_MALLOC_INC
228 p
= DBstrdup(file
, line
, p
);
236 #else /* ! _DEBUG_MALLOC_INC */
243 if ((p
= strdup(p
)) == NULL
) {
250 #endif /* ! _DEBUG_MALLOC_INC */