Loading...
--- Libc/Libc-1272.200.26/include/stdlib.h
+++ Libc/Libc-1244.20.1/include/stdlib.h
@@ -59,7 +59,6 @@
#define _STDLIB_H_
#include <Availability.h>
-#include <sys/cdefs.h>
#include <_types.h>
#if !defined(_ANSI_SOURCE)
@@ -130,7 +129,13 @@
#define LIBC_ABORT(f,...) abort_report_np("%s:%s:%u: " f, __FILE__, __func__, __LINE__, ## __VA_ARGS__)
//End-Libc
-#include <malloc/_malloc.h>
+#ifndef __alloc_size
+#if __has_attribute(alloc_size)
+#define __alloc_size(...) __attribute__((alloc_size(__VA_ARGS__)))
+#else
+#define __alloc_size(...)
+#endif
+#endif // __alloc_size
__BEGIN_DECLS
void abort(void) __dead2;
@@ -145,10 +150,10 @@
#endif /* !__DARWIN_NO_LONG_LONG */
void *bsearch(const void *__key, const void *__base, size_t __nel,
size_t __width, int (* _Nonnull __compar)(const void *, const void *));
-/* calloc is now declared in _malloc.h */
+void *calloc(size_t __count, size_t __size) __result_use_check __alloc_size(1,2);
div_t div(int, int) __pure2;
void exit(int) __dead2;
-/* free is now declared in _malloc.h */
+void free(void *);
char *getenv(const char *);
long labs(long) __pure2;
ldiv_t ldiv(long, long) __pure2;
@@ -157,15 +162,15 @@
llabs(long long);
lldiv_t lldiv(long long, long long);
#endif /* !__DARWIN_NO_LONG_LONG */
-/* malloc is now declared in _malloc.h */
+void *malloc(size_t __size) __result_use_check __alloc_size(1);
int mblen(const char *__s, size_t __n);
size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t);
int mbtowc(wchar_t * __restrict, const char * __restrict, size_t);
-/* posix_memalign is now declared in _malloc.h */
+int posix_memalign(void **__memptr, size_t __alignment, size_t __size) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
void qsort(void *__base, size_t __nel, size_t __width,
int (* _Nonnull __compar)(const void *, const void *));
int rand(void) __swift_unavailable("Use arc4random instead.");
-/* realloc is now declared in _malloc.h */
+void *realloc(void *__ptr, size_t __size) __result_use_check __alloc_size(2);
void srand(unsigned) __swift_unavailable("Use arc4random instead.");
double strtod(const char *, char **) __DARWIN_ALIAS(strtod);
float strtof(const char *, char **) __DARWIN_ALIAS(strtof);
@@ -232,11 +237,6 @@
long nrand48(unsigned short[3]) __swift_unavailable("Use arc4random instead.");
int posix_openpt(int);
char *ptsname(int);
-
-#if (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
-int ptsname_r(int fildes, char *buffer, size_t buflen) __API_AVAILABLE(macos(10.13.4), ios(11.3), tvos(11.3), watchos(4.3));
-#endif
-
//Begin-Libc
#ifndef LIBC_ALIAS_PUTENV
//End-Libc
@@ -400,7 +400,7 @@
strtouq(const char *__str, char **__endptr, int __base);
#endif /* !__DARWIN_NO_LONG_LONG */
extern char *suboptarg; /* getsubopt(3) external variable */
-/* valloc is now declared in _malloc.h */
+void *valloc(size_t) __alloc_size(1);
#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
/* Poison the following routines if -fshort-wchar is set */