Add support for storing local symbols in a small structure to save
[binutils.git] / libiberty / calloc.c
blobc8c0a78a7a131a2e3d2f052e7d2107a455397c2a
1 #include "ansidecl.h"
2 #include "libiberty.h"
4 #ifdef ANSI_PROTOTYPES
5 #include <stddef.h>
6 #else
7 #define size_t unsigned long
8 #endif
10 /* For systems with larger pointers than ints, this must be declared. */
11 PTR malloc PARAMS ((size_t));
13 PTR
14 calloc (nelem, elsize)
15 size_t nelem, elsize;
17 register PTR ptr;
19 if (nelem == 0 || elsize == 0)
20 nelem = elsize = 1;
22 ptr = malloc (nelem * elsize);
23 if (ptr) bzero (ptr, nelem * elsize);
25 return ptr;