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