from the ANSI standard
[unix-history] / usr / src / lib / libc / stdlib / calloc.c
CommitLineData
3639a16a
KB
1/*-
2 * Copyright (c) 1990 The Regents of the University of California.
08e97220
KB
3 * All rights reserved.
4 *
3639a16a 5 * %sccs.include.redist.c%
c488b005 6 */
08e97220
KB
7
8#if defined(LIBC_SCCS) && !defined(lint)
3639a16a 9static char sccsid[] = "@(#)calloc.c 5.4 (Berkeley) %G%";
08e97220
KB
10#endif /* LIBC_SCCS and not lint */
11
3639a16a 12#include <stdlib.h>
08e97220 13
3639a16a
KB
14void *
15calloc(num, size)
16 size_t num;
17 register size_t size;
18a0be3d 18{
3639a16a 19 register void *p;
18a0be3d 20
3639a16a
KB
21 size *= num;
22 if (p = malloc(size))
23 bzero(p, size);
08e97220 24 return(p);
18a0be3d
BJ
25}
26
3639a16a
KB
27cfree(p, num, size)
28 void *p;
29 size_t num, size;
18a0be3d 30{
3639a16a 31 (void)free(p);
18a0be3d 32}