diff options
author | Evan Cheng <evan.cheng@apple.com> | 2006-03-13 21:22:43 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2006-03-13 21:22:43 +0000 |
commit | 7abddda6cc7101623d589b7bf7cedf873fac0b94 (patch) | |
tree | 09963dbb1728eb0fb8d808ea1fe64927875a1537 /runtime | |
parent | ac0f8f29290ff018d51ce58bd11be13ab148e698 (diff) |
Optimizing to calloc() to malloc() + memset() can be bad on some platforms.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26732 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/GCCLibraries/libc/memory.c | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/runtime/GCCLibraries/libc/memory.c b/runtime/GCCLibraries/libc/memory.c deleted file mode 100644 index ebca404d48..0000000000 --- a/runtime/GCCLibraries/libc/memory.c +++ /dev/null @@ -1,33 +0,0 @@ -//===-- memory.c - String functions for the LLVM libc Library ----*- C -*-===// -// -// A lot of this code is ripped gratuitously from glibc and libiberty. -// -//===---------------------------------------------------------------------===// - -#include <stdlib.h> - -// If we're not being compiled with GCC, turn off attributes. Question is how -// to handle overriding of memory allocation functions in that case. -#ifndef __GNUC__ -#define __attribute__(X) -#endif - -// For now, turn off the weak linkage attribute on Mac OS X. -#if defined(__GNUC__) && defined(__APPLE_CC__) -#define __ATTRIBUTE_WEAK__ -#elif defined(__GNUC__) -#define __ATTRIBUTE_WEAK__ __attribute__((weak)) -#else -#define __ATTRIBUTE_WEAK__ -#endif - -void *malloc(size_t) __ATTRIBUTE_WEAK__; -void free(void *) __ATTRIBUTE_WEAK__; -void *memset(void *, int, size_t) __ATTRIBUTE_WEAK__; -void *calloc(size_t nelem, size_t elsize) __ATTRIBUTE_WEAK__; - -void *calloc(size_t nelem, size_t elsize) { - void *Result = malloc(nelem*elsize); - if (Result) memset(Result, 0, nelem*elsize); - return Result; -} |