diff options
author | Richard Henderson <rth@redhat.com> | 1999-05-03 07:29:11 +0000 |
---|---|---|
committer | Richard Henderson <rth@redhat.com> | 1999-05-03 07:29:11 +0000 |
commit | 252b5132c753830d5fd56823373aed85f2a0db63 (patch) | |
tree | 1af963bfd8d3e55167b81def4207f175eaff3a56 /libiberty/calloc.c | |
download | gdb-252b5132c753830d5fd56823373aed85f2a0db63.zip gdb-252b5132c753830d5fd56823373aed85f2a0db63.tar.gz gdb-252b5132c753830d5fd56823373aed85f2a0db63.tar.bz2 |
19990502 sourceware importbinu_ss_19990502
Diffstat (limited to 'libiberty/calloc.c')
-rw-r--r-- | libiberty/calloc.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/libiberty/calloc.c b/libiberty/calloc.c new file mode 100644 index 0000000..c8c0a78 --- /dev/null +++ b/libiberty/calloc.c @@ -0,0 +1,26 @@ +#include "ansidecl.h" +#include "libiberty.h" + +#ifdef ANSI_PROTOTYPES +#include <stddef.h> +#else +#define size_t unsigned long +#endif + +/* For systems with larger pointers than ints, this must be declared. */ +PTR malloc PARAMS ((size_t)); + +PTR +calloc (nelem, elsize) + size_t nelem, elsize; +{ + register PTR ptr; + + if (nelem == 0 || elsize == 0) + nelem = elsize = 1; + + ptr = malloc (nelem * elsize); + if (ptr) bzero (ptr, nelem * elsize); + + return ptr; +} |