aboutsummaryrefslogtreecommitdiff
path: root/lib/alloc/alloc_heap.c
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-10-03 00:36:26 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-10-03 00:36:26 +0200
commitd874d01e8e9a30f0073a6e559cbae07244dec7bf (patch)
treedbde18d7ada337b74fe6cfb8ccc35b52008e6aa0 /lib/alloc/alloc_heap.c
parent1e721a413f1d4fc7f7f4e1e691a0a37168f3b302 (diff)
Huge library overhaul
Diffstat (limited to 'lib/alloc/alloc_heap.c')
-rw-r--r--lib/alloc/alloc_heap.c31
1 files changed, 0 insertions, 31 deletions
diff --git a/lib/alloc/alloc_heap.c b/lib/alloc/alloc_heap.c
deleted file mode 100644
index fccfcfc..0000000
--- a/lib/alloc/alloc_heap.c
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <errno.h>
-#include <setjmp.h>
-#include <stdckdint.h>
-#include <stddef.h>
-#include <stdlib.h>
-
-#include "alloc.h"
-#include "errors.h"
-
-void *
-alloc_heap(void *raw_ctx, void *ptr, size_t, size_t new, size_t elemsz, size_t)
-{
- if (new == 0) {
- free(ptr);
- return nullptr;
- }
-
- if (!ckd_mul(&new, new, elemsz)) {
- void *p = realloc(ptr, new);
- if (p != nullptr)
- return p;
- } else
- errno = EOVERFLOW;
-
- struct heap_ctx *ctx = raw_ctx;
- if (ctx == nullptr || ctx->jmp == nullptr)
- err("realloc:");
-
- longjmp(*ctx->jmp, 1);
- unreachable();
-}