summaryrefslogtreecommitdiff
path: root/userland/libc/malloc/malloc.c
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-04-18 16:47:36 +0200
committerAnton Kling <anton@kling.gg>2024-04-18 16:47:36 +0200
commit568a0b7017e8e779731325083015907b006866c3 (patch)
treeae2f78d7fee945a90e29eb3eb71024be43077d76 /userland/libc/malloc/malloc.c
parentcc2b68cb26738dce0c7696ca0fe5b0cd8b24c171 (diff)
LibC: Fix compiler warnings
It can now compile with almost all compiler warnings turned on without producing any warnings.
Diffstat (limited to 'userland/libc/malloc/malloc.c')
-rw-r--r--userland/libc/malloc/malloc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/userland/libc/malloc/malloc.c b/userland/libc/malloc/malloc.c
index bd880b8..19fc91e 100644
--- a/userland/libc/malloc/malloc.c
+++ b/userland/libc/malloc/malloc.c
@@ -2,8 +2,12 @@
#include <math.h>
#include <stdarg.h>
#include <stddef.h>
+#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+#include <sys/random.h>
#include <typedefs.h>
+#include <unistd.h>
#define NEW_ALLOC_SIZE 0x5000
#define IS_FREE (1 << 0)
@@ -27,7 +31,7 @@ u32 total_heap_size = 0;
// printf without using malloc() so that it can be used internally by
// malloc() such that it does not have a stack overflow.
int debug_vprintf(const char *fmt, va_list ap) {
- const char buffer[4096];
+ char buffer[4096];
int rc = vsnprintf(buffer, 4096, fmt, ap);
if (0 > rc) {
return -1;
@@ -188,7 +192,7 @@ void *int_malloc(size_t s, int recursion) {
free_entry->flags = 0;
free_entry->n = new_entry;
free_entry->magic = 0xdde51ab9410268b1;
- randomfill(rc, s);
+ randomfill(rc, s);
return rc;
}