xref: /csrg-svn/lib/libc/stdlib/calloc.c (revision 42117)
1*42117Sbostic /*-
2*42117Sbostic  * Copyright (c) 1990 The Regents of the University of California.
335702Sbostic  * All rights reserved.
435702Sbostic  *
5*42117Sbostic  * %sccs.include.redist.c%
635702Sbostic  */
735702Sbostic 
826543Sdonn #if defined(LIBC_SCCS) && !defined(lint)
9*42117Sbostic static char sccsid[] = "@(#)calloc.c	5.4 (Berkeley) 05/16/90";
1035702Sbostic #endif /* LIBC_SCCS and not lint */
111956Swnj 
12*42117Sbostic #include <stdlib.h>
1335702Sbostic 
14*42117Sbostic void *
15*42117Sbostic calloc(num, size)
16*42117Sbostic 	size_t num;
17*42117Sbostic 	register size_t size;
181956Swnj {
19*42117Sbostic 	register void *p;
201956Swnj 
21*42117Sbostic 	size *= num;
22*42117Sbostic 	if (p = malloc(size))
23*42117Sbostic 		bzero(p, size);
2435702Sbostic 	return(p);
251956Swnj }
261956Swnj 
27*42117Sbostic cfree(p, num, size)
28*42117Sbostic 	void *p;
29*42117Sbostic 	size_t num, size;
301956Swnj {
31*42117Sbostic 	(void)free(p);
321956Swnj }
33