xref: /titanic_41/usr/src/cmd/sgs/prof/common/symintUtil.c (revision 8eea8e29cc4374d1ee24c25a07f45af132db3499)
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 /*	Copyright (c) 1988 AT&T	*/
23 /*	  All Rights Reserved  	*/
24 
25 
26 #pragma ident	"%Z%%M%	%I%	%E% SMI"
27 
28 /*
29 *	file: symintUtil.c
30 *	desc: utilities for symint code
31 *	date: 11/08/88
32 */
33 #include <stdio.h>
34 #include <sys/types.h>
35 #include "debug.h"
36 
37 /*
38 *	_Malloc and _Realloc are used to monitor the allocation
39 *	of memory.  If failure occurs, we detect it and exit.
40 */
41 
42 void *
43 _Malloc(item_count, item_size)
44 uint item_count;
45 uint item_size;
46 {
47 	char *malloc();
48 	register void *p;
49 
50 	if ((p = (void *) calloc(item_count, item_size)) == NULL) {
51 		DEBUG_EXP(printf("- size=%d, count=%d\n", item_size, item_count));
52 		_err_exit("calloc: Out of space");
53 	}
54 	return (p);
55 }
56 
57 void *
58 _Realloc(pointer, size)
59 void *pointer;
60 uint size;
61 {
62 	char *realloc();
63 	register void *p;
64 
65 	if ((p = (void *) realloc(pointer, size)) == NULL) {
66 		_err_exit("realloc: Out of space");
67 	}
68 	return (p);
69 }
70 
71