-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stop using system STL since it is no longer supported
- Loading branch information
Showing
5 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#ifndef __NEW__ | ||
#define __NEW__ | ||
|
||
#include <stddef.h> | ||
#include <stdlib.h> | ||
|
||
extern "C++" { | ||
|
||
namespace std { | ||
using ::ptrdiff_t; | ||
using ::size_t; | ||
struct nothrow_t {}; | ||
extern const nothrow_t nothrow; | ||
} // namespace std | ||
|
||
void* operator new(std::size_t); | ||
void* operator new[](std::size_t); | ||
void operator delete(void*); | ||
void operator delete[](void*); | ||
void* operator new(std::size_t, const std::nothrow_t&); | ||
void* operator new[](std::size_t, const std::nothrow_t&); | ||
void operator delete(void*, const std::nothrow_t&); | ||
void operator delete[](void*, const std::nothrow_t&); | ||
|
||
inline void* operator new(std::size_t, void* p) { return p; } | ||
inline void* operator new[](std::size_t, void* p) { return p; } | ||
|
||
// these next two are not really required, since exceptions are off | ||
inline void operator delete(void*, void*) { } | ||
inline void operator delete[](void*, void*) { } | ||
|
||
} // extern C++ | ||
|
||
#endif // __NEW__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <new> | ||
#include <stdlib.h> | ||
|
||
void* operator new(std::size_t s) { return malloc(s); } | ||
void* operator new[](std::size_t s) { return malloc(s); } | ||
void operator delete(void *p) { free(p); } | ||
void operator delete[](void *p) { free(p); } | ||
void* operator new(std::size_t s, const std::nothrow_t&) { return malloc(s); } | ||
void* operator new[](std::size_t s, const std::nothrow_t&) { return malloc(s); } | ||
void operator delete(void *p, const std::nothrow_t&) { free(p); } | ||
void operator delete[](void *p, const std::nothrow_t&) { free(p); } |