Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(614)

Unified Diff: base/allocator/allocator_shim.cc

Issue 12256047: Change call_new_handler to be non extern C; not called outside this code and it's causing issues wi… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor fixups for 12256047 Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/allocator/allocator_shim.cc
diff --git a/base/allocator/allocator_shim.cc b/base/allocator/allocator_shim.cc
index 8801e4c9b47dc1b541c462fb6a3d2afd634d41cc..1d8229117d77a27035c84a33523b230eea7a3351 100644
--- a/base/allocator/allocator_shim.cc
+++ b/base/allocator/allocator_shim.cc
@@ -73,8 +73,6 @@ bool je_malloc_init_hard();
void* je_memalign(size_t a, size_t s);
}
-extern "C" {
-
// Call the new handler, if one has been set.
// Returns true on successfully calling the handler, false otherwise.
inline bool call_new_handler(bool nothrow) {
@@ -88,7 +86,8 @@ inline bool call_new_handler(bool nothrow) {
nh = std::set_new_handler(0);
(void) std::set_new_handler(nh);
}
-#if (defined(__GNUC__) && !defined(__EXCEPTIONS)) || (defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS)
+#if (defined(__GNUC__) && !defined(__EXCEPTIONS)) || \
+ (defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS)
if (!nh)
return false;
// Since exceptions are disabled, we don't really know if new_handler
@@ -99,7 +98,7 @@ inline bool call_new_handler(bool nothrow) {
// If no new_handler is established, the allocation failed.
if (!nh) {
if (nothrow)
- return 0;
+ return false;
throw std::bad_alloc();
}
// Otherwise, try the new_handler. If it returns, retry the
@@ -113,8 +112,10 @@ inline bool call_new_handler(bool nothrow) {
return true;
}
#endif // (defined(__GNUC__) && !defined(__EXCEPTIONS)) || (defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS)
+ return false;
}
+extern "C" {
void* malloc(size_t size) __THROW {
void* ptr;
for (;;) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698