CeDOS - Commit 7a8f2251

treewide: Fix headers NULL is already part of stddef.h and need not be redefined. Signed-off-by: Celina Sophie Kalus <hello@celinakalus.de>
Celina Sophie Kalus
Sat, 07 Jun 2025 09:29:07 +0200
9 files changed, 14 insertions(+), 31 deletions(-)
D boot/string.h

@@ -1,12 +0,0 @@

-#ifndef STRING_H -#define STRING_H - -#include <stdint.h> - -#define NULL (void*)(0) - -void *memset(void *ptr, uint8_t value, uint32_t num); -int strcmp(const char *str1, const char *str2); -void *memcpy(void *dest, const void * src, uint32_t n); - -#endif
M common/memory.ccommon/memory.c

@@ -1,14 +1,15 @@

+#include <stddef.h> +#include <string.h> +#include <assert.h> + #include "memory.h" -#include "string.h" - -#include "assert.h" struct memblock { struct memblock *next; size_t size; }; -volatile struct memblock volatile *malloc_first, *malloc_last, *malloc_next_free; +volatile struct memblock *malloc_first, *malloc_last, *malloc_next_free; int malloc_init(void *start, void *end) { uint32_t mem_start = (uint32_t)(start);
M common/memory.hcommon/memory.h

@@ -8,8 +8,6 @@ #include <stdint.h>

typedef uint32_t size_t; -#define NULL (void*)(0) - /*! * Initialize memory allocator with predefined memory region. * \param start Start of malloc memory region.
M common/string.hcommon/string.h

@@ -5,8 +5,7 @@ #ifndef STRING_H

#define STRING_H #include <stdint.h> - -#define NULL ((void*)0) +#include <stddef.h> #define WHITESPACE(c) ((c) == ' ' || (c) == '\t') #define IS_UPPER(c) ((c) >= 'A' && (c) <= 'Z')
M kernel/interrupts.ckernel/interrupts.c

@@ -8,7 +8,6 @@ #include "core.h"

#include "pit.h" #define array_sizeof(array) (sizeof(array)/sizeof(array[0])) -#define NULL ((void*)0) #define MAKE_IDT_ENTRY(func, selector, type) { \ (uint16_t)(func), \

@@ -85,4 +84,4 @@ "m" (IDT_DESC)

); return 1; -}+}
M kernel/sched/process.ckernel/sched/process.c

@@ -1,6 +1,6 @@

-#include "sched/process.h" +#include <stddef.h> -#define NULL ((void*)0) +#include "sched/process.h" PROCESS* list_head = NULL; PROCESS* list_tail = NULL;

@@ -119,4 +119,4 @@ * \return Number of running processes.

*/ uint32_t get_process_count(void) { return process_count; -}+}
M kernel/sched/sched.ckernel/sched/sched.c

@@ -323,4 +323,4 @@ // just for absolute safety

kpanic("Executing a terminated process!!\n"); return 0; -}+}
M kernel/sched/sched_strats.ckernel/sched/sched_strats.c

@@ -1,6 +1,6 @@

-#include "sched/process.h" +#include <stddef.h> -#define NULL ((void*)0) +#include "sched/process.h" PROCESS_ID next_schedule(PROCESS_ID current) { PROCESS* next = get_first_process();

@@ -30,4 +30,4 @@ return choice->id;

} else { return 0; } -}+}
M libcedos/stdlib.hlibcedos/stdlib.h

@@ -8,8 +8,6 @@ #include <stdint.h>

typedef uint32_t size_t; -#define NULL (void*)(0) - /*! * Initialize memory allocator with predefined memory region. * \param start Start of malloc memory region.