blob: 1cbab4ac59ca5b7884442199adff09c684ba2ec3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
/*
* libc/stdlib/malloc/calloc.c -- calloc function
*
* Copyright (C) 2002 NEC Corporation
* Copyright (C) 2002 Miles Bader <miles@gnu.org>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License. See the file COPYING.LIB in the main
* directory of this archive for more details.
*
* Written by Miles Bader <miles@gnu.org>
*/
#include <stdlib.h>
#include <string.h>
#include "malloc.h"
void *
calloc (size_t size, size_t num)
{
void *mem;
size *= num;
mem = malloc (size);
if (mem)
memset (mem, 0, size);
return mem;
}
|