| 876 | #ifdef __cplusplus |
| 877 | #include <new> |
| 878 | static bool mi_try_new_handler(bool nothrow) { |
| 879 | #if defined(_MSC_VER) || (__cplusplus >= 201103L) |
| 880 | std::new_handler h = std::get_new_handler(); |
| 881 | #else |
| 882 | std::new_handler h = std::set_new_handler(); |
| 883 | std::set_new_handler(h); |
| 884 | #endif |
| 885 | if (h==NULL) { |
| 886 | _mi_error_message(ENOMEM, "out of memory in 'new'"); |
| 887 | if (!nothrow) { |
| 888 | throw std::bad_alloc(); |
| 889 | } |
| 890 | return false; |
| 891 | } |
| 892 | else { |
| 893 | h(); |
| 894 | return true; |
| 895 | } |
| 896 | } |
| 897 | #else |
| 898 | typedef void (*std_new_handler_t)(void); |
| 899 |
no test coverage detected