xref: /onnv-gate/usr/src/lib/libidmap/common/sized_array.h (revision 10122:96eda55bfd54)
1*10122SJordan.Brown@Sun.COM /*
2*10122SJordan.Brown@Sun.COM  * CDDL HEADER START
3*10122SJordan.Brown@Sun.COM  *
4*10122SJordan.Brown@Sun.COM  * The contents of this file are subject to the terms of the
5*10122SJordan.Brown@Sun.COM  * Common Development and Distribution License (the "License").
6*10122SJordan.Brown@Sun.COM  * You may not use this file except in compliance with the License.
7*10122SJordan.Brown@Sun.COM  *
8*10122SJordan.Brown@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*10122SJordan.Brown@Sun.COM  * or http://www.opensolaris.org/os/licensing.
10*10122SJordan.Brown@Sun.COM  * See the License for the specific language governing permissions
11*10122SJordan.Brown@Sun.COM  * and limitations under the License.
12*10122SJordan.Brown@Sun.COM  *
13*10122SJordan.Brown@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
14*10122SJordan.Brown@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*10122SJordan.Brown@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
16*10122SJordan.Brown@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
17*10122SJordan.Brown@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
18*10122SJordan.Brown@Sun.COM  *
19*10122SJordan.Brown@Sun.COM  * CDDL HEADER END
20*10122SJordan.Brown@Sun.COM  */
21*10122SJordan.Brown@Sun.COM 
22*10122SJordan.Brown@Sun.COM /*
23*10122SJordan.Brown@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24*10122SJordan.Brown@Sun.COM  * Use is subject to license terms.
25*10122SJordan.Brown@Sun.COM  */
26*10122SJordan.Brown@Sun.COM 
27*10122SJordan.Brown@Sun.COM #ifndef _SIZED_ARRAY_H
28*10122SJordan.Brown@Sun.COM #define	_SIZED_ARRAY_H
29*10122SJordan.Brown@Sun.COM 
30*10122SJordan.Brown@Sun.COM /*
31*10122SJordan.Brown@Sun.COM  * Like calloc, but with mechanisms to get the size of the allocated
32*10122SJordan.Brown@Sun.COM  * area given only the pointer.
33*10122SJordan.Brown@Sun.COM  */
34*10122SJordan.Brown@Sun.COM 
35*10122SJordan.Brown@Sun.COM #ifdef __cplusplus
36*10122SJordan.Brown@Sun.COM extern "C" {
37*10122SJordan.Brown@Sun.COM #endif
38*10122SJordan.Brown@Sun.COM 
39*10122SJordan.Brown@Sun.COM void *sized_array(size_t n, size_t sz);
40*10122SJordan.Brown@Sun.COM void sized_array_free(void *p);
41*10122SJordan.Brown@Sun.COM size_t sized_array_n(void *p);
42*10122SJordan.Brown@Sun.COM size_t sized_array_sz(void *p);
43*10122SJordan.Brown@Sun.COM 
44*10122SJordan.Brown@Sun.COM #ifdef __cplusplus
45*10122SJordan.Brown@Sun.COM }
46*10122SJordan.Brown@Sun.COM #endif
47*10122SJordan.Brown@Sun.COM 
48*10122SJordan.Brown@Sun.COM #endif /* _SIZED_ARRAY_H */
49