* gdb.base/constvars.exp: Check for different orders of keywords
[deliverable/binutils-gdb.git] / libiberty / calloc.c
CommitLineData
e2eaf477
ILT
1/* calloc -- allocate memory which has been initialized to zero.
2 This function is in the public domain. */
3
252b5132
RH
4#include "ansidecl.h"
5#include "libiberty.h"
6
7#ifdef ANSI_PROTOTYPES
8#include <stddef.h>
9#else
10#define size_t unsigned long
11#endif
12
13/* For systems with larger pointers than ints, this must be declared. */
14PTR malloc PARAMS ((size_t));
15
16PTR
17calloc (nelem, elsize)
18 size_t nelem, elsize;
19{
20 register PTR ptr;
21
22 if (nelem == 0 || elsize == 0)
23 nelem = elsize = 1;
24
25 ptr = malloc (nelem * elsize);
26 if (ptr) bzero (ptr, nelem * elsize);
27
28 return ptr;
29}
This page took 0.07505 seconds and 4 git commands to generate.