haiku/headers/posix/malloc.h
Fredrik Holmqvist 48eb7d981d Allow gcc to know result is aligned
Someone on the internet found out gcc only understand posix_memalign.

The alloc_align attribute may be applied to a function that returns
a pointer and takes at least one argument of an integer or enumerated
type. It indicates that the returned pointer is aligned on a boundary
given by the function argument at position.

Change-Id: I4b0af6ef3020da1fb460652117286193d5d72f1e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4514
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2021-10-14 16:19:18 +00:00

32 lines
628 B
C

/*
* Copyright 2002-2021 Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _MALLOC_H
#define _MALLOC_H
#include <unistd.h>
#ifdef __cplusplus
extern "C" {
#endif
extern void *malloc(size_t numBytes);
extern void *realloc(void *oldPointer, size_t newSize);
extern void *calloc(size_t numElements, size_t size);
extern void free(void *pointer);
extern void *memalign(size_t alignment, size_t numBytes) _ALIGNED_BY_ARG(1);
extern void *valloc(size_t numBytes);
#ifdef _GNU_SOURCE
size_t malloc_usable_size(void *ptr);
#endif
#ifdef __cplusplus
}
#endif
#endif /* _MALLOC_H */