This commit is contained in:
Julian Barathieu 2020-01-20 19:21:07 +01:00
parent 3bba87c227
commit 5b69c0a1e9
2 changed files with 16 additions and 0 deletions

View File

@ -168,6 +168,7 @@ unsigned long strtoul(const char *restrict, char **restrict, int);
//----------------------------------------------------------------------------//
void *calloc(size_t, size_t) __attribute__((__malloc__));
void *memalign(size_t n, size_t align) __attribute__((__malloc__));
void *malloc(size_t) __attribute__((__malloc__));
void free(void *);

View File

@ -46,6 +46,21 @@ void *malloc(size_t n)
return ptr;
}
void *memalign(size_t n, size_t align)
{
void *ptr;
error_t rc;
#ifndef _KALEID_KERNEL
rc = KalAllocMemoryEx(&ptr, n, 0, align);
#else
rc = KalAllocMemoryEx(&ptr, n, M_ZEROED, align);
#endif
if (rc > 0) seterrno(rc);
return ptr;
}
void *calloc(size_t n, size_t m)
{
void *ptr;