2020-03-21 14:12:26 +01:00
|
|
|
#ifndef __CLOVER_STDLIB_H__
|
|
|
|
#define __CLOVER_STDLIB_H__
|
|
|
|
|
2020-09-07 00:19:48 +02:00
|
|
|
#ifdef __cplusplus
|
2020-03-21 14:12:26 +01:00
|
|
|
extern "C" {
|
2020-09-07 00:19:48 +02:00
|
|
|
#endif
|
|
|
|
|
2020-03-21 14:12:26 +01:00
|
|
|
#include <Library/MemoryAllocationLib.h>
|
2020-09-07 00:19:48 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
2020-03-21 14:12:26 +01:00
|
|
|
}
|
2020-09-07 00:19:48 +02:00
|
|
|
#endif
|
2020-03-21 14:12:26 +01:00
|
|
|
|
|
|
|
#include "stddef.h" // for size_t
|
|
|
|
|
2021-05-08 11:34:17 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2020-03-13 14:11:58 +01:00
|
|
|
void abort(void);
|
2020-03-21 14:12:26 +01:00
|
|
|
|
|
|
|
inline void* malloc(size_t size)
|
|
|
|
{
|
2021-05-09 16:13:37 +02:00
|
|
|
return AllocatePool(size);
|
2020-03-21 14:12:26 +01:00
|
|
|
}
|
|
|
|
|
2020-09-07 00:19:48 +02:00
|
|
|
inline void* reallocWithOldSize(void *ptr, size_t newsize, size_t oldsize) // not the posix realloc. For EFI we need oldsize
|
2020-03-21 14:12:26 +01:00
|
|
|
{
|
2021-05-09 16:13:37 +02:00
|
|
|
return ReallocatePool(oldsize, newsize, ptr);
|
2020-03-21 14:12:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void free(void *ptr)
|
|
|
|
{
|
2021-05-09 16:13:37 +02:00
|
|
|
FreePool(ptr);
|
2020-03-21 14:12:26 +01:00
|
|
|
}
|
|
|
|
|
2021-05-09 16:13:37 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2020-03-21 14:12:26 +01:00
|
|
|
#endif
|