Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Dionne <ldionne@apple.com>2019-10-01 21:43:02 +0300
committerLouis Dionne <ldionne@apple.com>2019-10-01 21:43:02 +0300
commit04501a22a073d0f64e980aaa8c895a6e86c0a103 (patch)
treef6fcc36facda36f7093498ea88cad3b7b69f1a6c /libcxxabi/src/fallback_malloc.cpp
parentae40dfc1e3ce5f64be3234ed7958792f15800181 (diff)
[libc++abi] Remove uses of C++ headers when possible
This reduces the (circular) dependency of libc++abi on a C++ standard library. Outside of the demangler which uses fancier C++ features, the only C++ headers now required by libc++abi are pretty much <new> and <exception>, and that's because libc++abi defines some types that are declared in those headers. llvm-svn: 373381
Diffstat (limited to 'libcxxabi/src/fallback_malloc.cpp')
-rw-r--r--libcxxabi/src/fallback_malloc.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/libcxxabi/src/fallback_malloc.cpp b/libcxxabi/src/fallback_malloc.cpp
index 9d6240752a1a..8f301bcacd14 100644
--- a/libcxxabi/src/fallback_malloc.cpp
+++ b/libcxxabi/src/fallback_malloc.cpp
@@ -18,8 +18,8 @@
#endif
#endif
-#include <cstdlib> // for malloc, calloc, free
-#include <cstring> // for memset
+#include <stdlib.h> // for malloc, calloc, free
+#include <string.h> // for memset
// A small, simple heap manager based (loosely) on
// the startup heap manager from FreeBSD, optimized for space.
@@ -214,7 +214,7 @@ void* __aligned_malloc_with_fallback(size_t size) {
if (void* dest = _aligned_malloc(size, alignof(__aligned_type)))
return dest;
#elif defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION)
- if (void* dest = std::malloc(size))
+ if (void* dest = ::malloc(size))
return dest;
#else
if (size == 0)
@@ -227,13 +227,13 @@ void* __aligned_malloc_with_fallback(size_t size) {
}
void* __calloc_with_fallback(size_t count, size_t size) {
- void* ptr = std::calloc(count, size);
+ void* ptr = ::calloc(count, size);
if (NULL != ptr)
return ptr;
// if calloc fails, fall back to emergency stash
ptr = fallback_malloc(size * count);
if (NULL != ptr)
- std::memset(ptr, 0, size * count);
+ ::memset(ptr, 0, size * count);
return ptr;
}
@@ -244,7 +244,7 @@ void __aligned_free_with_fallback(void* ptr) {
#if defined(_WIN32)
::_aligned_free(ptr);
#else
- std::free(ptr);
+ ::free(ptr);
#endif
}
}
@@ -253,7 +253,7 @@ void __free_with_fallback(void* ptr) {
if (is_fallback_ptr(ptr))
fallback_free(ptr);
else
- std::free(ptr);
+ ::free(ptr);
}
} // namespace __cxxabiv1