| 420 | static _Atomic(void*) mi_error_arg; // = NULL |
| 421 | |
| 422 | static void mi_error_default(int err) { |
| 423 | MI_UNUSED(err); |
| 424 | #if (MI_DEBUG>0) |
| 425 | if (err==EFAULT) { |
| 426 | #ifdef _MSC_VER |
| 427 | __debugbreak(); |
| 428 | #endif |
| 429 | abort(); |
| 430 | } |
| 431 | #endif |
| 432 | #if (MI_SECURE>0) |
| 433 | if (err==EFAULT) { // abort on serious errors in secure mode (corrupted meta-data) |
| 434 | abort(); |
| 435 | } |
| 436 | #endif |
| 437 | #if defined(MI_XMALLOC) |
| 438 | if (err==ENOMEM || err==EOVERFLOW) { // abort on memory allocation fails in xmalloc mode |
| 439 | abort(); |
| 440 | } |
| 441 | #endif |
| 442 | } |
| 443 | |
| 444 | void mi_register_error(mi_error_fun* fun, void* arg) { |
| 445 | mi_error_handler = fun; // can be NULL |