#include <new>
+#include <bits/functexcept.h>
+
/**
* Declare rallocm() and malloc_usable_size() as weak symbols. It
* will be provided by jemalloc if we are using jemalloc, or it will
*/
inline void* checkedMalloc(size_t size) {
void* p = malloc(size);
- if (!p) throw std::bad_alloc();
+ if (!p) std::__throw_bad_alloc();
return p;
}
inline void* checkedCalloc(size_t n, size_t size) {
void* p = calloc(n, size);
- if (!p) throw std::bad_alloc();
+ if (!p) std::__throw_bad_alloc();
return p;
}
inline void* checkedRealloc(void* ptr, size_t size) {
void* p = realloc(ptr, size);
- if (!p) throw std::bad_alloc();
+ if (!p) std::__throw_bad_alloc();
return p;
}