1 /* 2 * Copyright (c) 2018 Apple Computer, Inc. All rights reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. Please obtain a copy of the License at 10 * http://www.opensource.apple.com/apsl/ and read it before using this 11 * file. 12 * 13 * The Original Code and all software distributed under the License are 14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 * Please see the License for the specific language governing rights and 19 * limitations under the License. 20 * 21 * @APPLE_LICENSE_HEADER_END@ 22 */ 23 24 #ifndef _MALLOC_UNDERSCORE_MALLOC_H_ 25 #define _MALLOC_UNDERSCORE_MALLOC_H_ 26 27 /* 28 * This header is included from <stdlib.h>, so the contents of this file have 29 * broad source compatibility and POSIX conformance implications. 30 * Be cautious about what is included and declared here. 31 */ 32 33 #include <Availability.h> 34 #include <sys/cdefs.h> 35 #include <_types.h> 36 #include <sys/_types/_size_t.h> 37 38 __BEGIN_DECLS 39 40 void *malloc(size_t __size) __result_use_check __alloc_size(1); 41 void *calloc(size_t __count, size_t __size) __result_use_check __alloc_size(1,2); 42 void free(void *); 43 void *realloc(void *__ptr, size_t __size) __result_use_check __alloc_size(2); 44 #if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) 45 void *valloc(size_t) __alloc_size(1); 46 #endif // !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) 47 #if (__DARWIN_C_LEVEL >= __DARWIN_C_FULL) && \ 48 ((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \ 49 (defined(__cplusplus) && __cplusplus >= 201703L)) 50 void *aligned_alloc(size_t __alignment, size_t __size) __result_use_check __alloc_size(2) __OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0); 51 #endif 52 int posix_memalign(void **__memptr, size_t __alignment, size_t __size) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0); 53 54 __END_DECLS 55 56 #endif /* _MALLOC_UNDERSCORE_MALLOC_H_ */