mirror of
https://github.com/drasko/codezero.git
synced 2026-02-13 18:33:15 +01:00
malloc is carried from POSIX to libmem/malloc.
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)
This commit is contained in:
committed by
Bahadir Balban
parent
5c93d9b8ba
commit
2c53feedb1
19
conts/libmem/malloc/malloc.h
Normal file
19
conts/libmem/malloc/malloc.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#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__ */
|
||||
Reference in New Issue
Block a user