xref: /csrg-svn/lib/libc/stdlib/calloc.c (revision 46599)
142117Sbostic /*-
242117Sbostic  * Copyright (c) 1990 The Regents of the University of California.
335702Sbostic  * All rights reserved.
435702Sbostic  *
542117Sbostic  * %sccs.include.redist.c%
635702Sbostic  */
735702Sbostic 
826543Sdonn #if defined(LIBC_SCCS) && !defined(lint)
9*46599Sdonn static char sccsid[] = "@(#)calloc.c	5.6 (Berkeley) 02/23/91";
1035702Sbostic #endif /* LIBC_SCCS and not lint */
111956Swnj 
1242117Sbostic #include <stdlib.h>
13*46599Sdonn #include <string.h>
1435702Sbostic 
1542117Sbostic void *
1642117Sbostic calloc(num, size)
1742117Sbostic 	size_t num;
1842117Sbostic 	register size_t size;
191956Swnj {
2042117Sbostic 	register void *p;
211956Swnj 
2242117Sbostic 	size *= num;
2342117Sbostic 	if (p = malloc(size))
2442117Sbostic 		bzero(p, size);
2535702Sbostic 	return(p);
261956Swnj }
271956Swnj 
2842185Sbostic void
29*46599Sdonn cfree(p)
3042117Sbostic 	void *p;
311956Swnj {
3242117Sbostic 	(void)free(p);
331956Swnj }
34