extension of the malloc function to check memory allocation errors
| 592 | |
| 593 | /// extension of the malloc function to check memory allocation errors |
| 594 | void* malloc_las(size_t size) { |
| 595 | bool warning = check_available_RAM(size); |
| 596 | |
| 597 | void* ptr = malloc(size); |
| 598 | if (!ptr && !warning) { |
| 599 | LASMessage(LAS_WARNING, "memory allocation failed"); |
| 600 | } |
| 601 | return ptr; |
| 602 | } |
| 603 | |
| 604 | /// Wrapper for `vsscanf` |
| 605 | int sscanf_las(const char* buffer, const char* format, ...) { |