add if statements

This commit is contained in:
2025-06-03 13:24:12 +01:00
parent ef61c391a1
commit 18993a5d7e
16 changed files with 148 additions and 26 deletions

View File

@@ -4,7 +4,16 @@
#include <gmp.h>
#include <stdlib.h> // for malloc/free (temp arena fallback)
#include <string.h>
#include <stdio.h>
void *checked_malloc(size_t size) {
void *ptr = malloc(size);
if (!ptr) {
fprintf(stderr, "fatal error: failed to allocate %zu bytes\n", size);
exit(EXIT_FAILURE);
}
return ptr;
}
void *gmp_gc_realloc(void *ptr, size_t old_size, size_t new_size) {
(void)old_size; // Ignore old_size, Boehm doesn't need it