Last change
on this file since 577 was
444,
checked in by satin@…, 6 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
1.1 KB
|
Line | |
---|
1 | #ifdef MALLOC_PROVIDED |
---|
2 | int _dummy_calloc = 1; |
---|
3 | #else |
---|
4 | /* |
---|
5 | FUNCTION |
---|
6 | <<calloc>>---allocate space for arrays |
---|
7 | |
---|
8 | INDEX |
---|
9 | calloc |
---|
10 | |
---|
11 | INDEX |
---|
12 | _calloc_r |
---|
13 | |
---|
14 | SYNOPSIS |
---|
15 | #include <stdlib.h> |
---|
16 | void *calloc(size_t <[n]>, size_t <[s]>); |
---|
17 | void *_calloc_r(void *<[reent]>, size_t <[n]>, size_t <[s]>); |
---|
18 | |
---|
19 | DESCRIPTION |
---|
20 | Use <<calloc>> to request a block of memory sufficient to hold an |
---|
21 | array of <[n]> elements, each of which has size <[s]>. |
---|
22 | |
---|
23 | The memory allocated by <<calloc>> comes out of the same memory pool |
---|
24 | used by <<malloc>>, but the memory block is initialized to all zero |
---|
25 | bytes. (To avoid the overhead of initializing the space, use |
---|
26 | <<malloc>> instead.) |
---|
27 | |
---|
28 | The alternate function <<_calloc_r>> is reentrant. |
---|
29 | The extra argument <[reent]> is a pointer to a reentrancy structure. |
---|
30 | |
---|
31 | RETURNS |
---|
32 | If successful, a pointer to the newly allocated space. |
---|
33 | |
---|
34 | If unsuccessful, <<NULL>>. |
---|
35 | |
---|
36 | PORTABILITY |
---|
37 | <<calloc>> is ANSI. |
---|
38 | |
---|
39 | Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>, |
---|
40 | <<lseek>>, <<read>>, <<sbrk>>, <<write>>. |
---|
41 | */ |
---|
42 | |
---|
43 | #include <string.h> |
---|
44 | #include <stdlib.h> |
---|
45 | |
---|
46 | #ifndef _REENT_ONLY |
---|
47 | |
---|
48 | void * |
---|
49 | calloc (size_t n, |
---|
50 | size_t size) |
---|
51 | { |
---|
52 | return _calloc_r (_REENT, n, size); |
---|
53 | } |
---|
54 | |
---|
55 | #endif |
---|
56 | #endif /* MALLOC_PROVIDED */ |
---|
Note: See
TracBrowser
for help on using the repository browser.