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 ANSI_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 TRAD_SYNOPSIS 20 #include <stdlib.h> 21 char *calloc(<[n]>, <[s]>) 22 size_t <[n]>, <[s]>; 23 24 char *_calloc_r(<[reent]>, <[n]>, <[s]>) 25 char *<[reent]>; 26 size_t <[n]>; 27 size_t <[s]>; 28 29 30 31 DESCRIPTION 32 Use <<calloc>> to request a block of memory sufficient to hold an 33 array of <[n]> elements, each of which has size <[s]>. 34 35 The memory allocated by <<calloc>> comes out of the same memory pool 36 used by <<malloc>>, but the memory block is initialized to all zero 37 bytes. (To avoid the overhead of initializing the space, use 38 <<malloc>> instead.) 39 40 The alternate function <<_calloc_r>> is reentrant. 41 The extra argument <[reent]> is a pointer to a reentrancy structure. 42 43 RETURNS 44 If successful, a pointer to the newly allocated space. 45 46 If unsuccessful, <<NULL>>. 47 48 PORTABILITY 49 <<calloc>> is ANSI. 50 51 Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>, 52 <<lseek>>, <<read>>, <<sbrk>>, <<write>>. 53 */ 54 55 #include <string.h> 56 #include <stdlib.h> 57 58 #ifndef _REENT_ONLY 59 60 _PTR 61 _DEFUN (calloc, (n, size), 62 size_t n _AND 63 size_t size) 64 { 65 return _calloc_r (_REENT, n, size); 66 } 67 68 #endif 69 #endif /* MALLOC_PROVIDED */ 70