LibC: Fix posix_memalign return value
I was returning -1 with errno instead of the error code :P
This commit is contained in:
@@ -424,12 +424,8 @@ void* aligned_alloc(size_t alignment, size_t size)
|
|||||||
int posix_memalign(void** memptr, size_t alignment, size_t size)
|
int posix_memalign(void** memptr, size_t alignment, size_t size)
|
||||||
{
|
{
|
||||||
if (alignment < sizeof(void*) || !BAN::Math::is_power_of_two(alignment))
|
if (alignment < sizeof(void*) || !BAN::Math::is_power_of_two(alignment))
|
||||||
{
|
return EINVAL;
|
||||||
errno = EINVAL;
|
return (*memptr = aligned_alloc(alignment, size)) ? 0 : errno;
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (*memptr = aligned_alloc(alignment, size)) ? 0 : -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t malloc_usable_size(void* ptr)
|
size_t malloc_usable_size(void* ptr)
|
||||||
|
|||||||
Reference in New Issue
Block a user