mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 10:53:16 +01:00
This malloc is a very simple first-fit sort of allocator. Now, it builds without any problem but because we havent fixed include paths and added it to the referenced libraries in the posix container yet, POSIX doesnt build. So take it with caution. (cherry picked from commit 65523743e86268eddd3bd2aab58476003f71c2c2)
20 lines
297 B
C
20 lines
297 B
C
#ifndef __PRIVATE_MALLOC_H__
|
|
#define __PRIVATE_MALLOC_H__
|
|
|
|
#include <stddef.h>
|
|
#include <string.h>
|
|
|
|
void *kmalloc(size_t size);
|
|
void kfree(void *blk);
|
|
|
|
static inline void *kzalloc(size_t size)
|
|
{
|
|
void *buf = kmalloc(size);
|
|
|
|
memset(buf, 0, size);
|
|
return buf;
|
|
}
|
|
|
|
|
|
#endif /*__PRIVATE_MALLOC_H__ */
|