* doc/gcov.texi: Use more logical markup.
[official-gcc.git] / libiberty / calloc.c
blob334b18db86a41d303e013e5380028942e663752d
1 /* calloc -- allocate memory which has been initialized to zero.
2 This function is in the public domain. */
4 #include "ansidecl.h"
5 #include "libiberty.h"
7 #ifdef ANSI_PROTOTYPES
8 #include <stddef.h>
9 #else
10 #define size_t unsigned long
11 #endif
13 /* For systems with larger pointers than ints, this must be declared. */
14 PTR malloc PARAMS ((size_t));
16 PTR
17 calloc (nelem, elsize)
18 size_t nelem, elsize;
20 register PTR ptr;
22 if (nelem == 0 || elsize == 0)
23 nelem = elsize = 1;
25 ptr = malloc (nelem * elsize);
26 if (ptr) bzero (ptr, nelem * elsize);
28 return ptr;