blob: a839832d1ce911e3e02e7089416f120d94a5ed52 [file] [log] [blame]
Chris Lattnerc1e20ac2002-03-08 23:20:52 +00001//===-- memory.c - String functions for the LLVM libc Library ----*- C -*-===//
2//
3// A lot of this code is ripped gratuitously from glibc and libiberty.
4//
5//===----------------------------------------------------------------------===//
6
7#include <stdlib.h>
8
Misha Brukmana5df0cd2003-12-15 22:32:50 +00009void *malloc(size_t) __attribute__((weak));
10void free(void *) __attribute__((weak));
11void *memset(void *, int, size_t) __attribute__((weak));
12void *calloc(size_t nelem, size_t elsize) __attribute__((weak));
Chris Lattnerc1e20ac2002-03-08 23:20:52 +000013
14void *calloc(size_t nelem, size_t elsize) {
15 void *Result = malloc(nelem*elsize);
16 return memset(Result, 0, nelem*elsize);
17}