xref: /csrg-svn/lib/libc/stdlib/calloc.c (revision 35702)
1*35702Sbostic /*
2*35702Sbostic  * Copyright (c) 1988 The Regents of the University of California.
3*35702Sbostic  * All rights reserved.
4*35702Sbostic  *
5*35702Sbostic  * Redistribution and use in source and binary forms are permitted
6*35702Sbostic  * provided that the above copyright notice and this paragraph are
7*35702Sbostic  * duplicated in all such forms and that any documentation,
8*35702Sbostic  * advertising materials, and other materials related to such
9*35702Sbostic  * distribution and use acknowledge that the software was developed
10*35702Sbostic  * by the University of California, Berkeley.  The name of the
11*35702Sbostic  * University may not be used to endorse or promote products derived
12*35702Sbostic  * from this software without specific prior written permission.
13*35702Sbostic  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14*35702Sbostic  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15*35702Sbostic  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16*35702Sbostic  */
17*35702Sbostic 
1826543Sdonn #if defined(LIBC_SCCS) && !defined(lint)
19*35702Sbostic static char sccsid[] = "@(#)calloc.c	5.3 (Berkeley) 09/22/88";
20*35702Sbostic #endif /* LIBC_SCCS and not lint */
211956Swnj 
22*35702Sbostic #include <sys/types.h>
23*35702Sbostic 
241956Swnj char *
25*35702Sbostic calloc(nelem, elsize)
26*35702Sbostic 	u_int nelem, elsize;
271956Swnj {
28*35702Sbostic 	char *p, *malloc();
291956Swnj 
30*35702Sbostic 	elsize *= nelem;
31*35702Sbostic 	if (p = malloc(elsize))
32*35702Sbostic 		bzero(p, elsize);
33*35702Sbostic 	return(p);
341956Swnj }
351956Swnj 
36*35702Sbostic /* ARGSUSED */
37*35702Sbostic cfree(p, nelem, elsize)
3817763Sserge 	char *p;
39*35702Sbostic 	u_int nelem, elsize;
401956Swnj {
411956Swnj 	free(p);
421956Swnj }
43