| author | |
| committer | |
| log | 1631dc923d48d8c586e57f793adcdfb97760ceb3 |
| tree | 36d8e5567bed0adf3cbdbe691c18f5d49b9ff5ac |
| parent | 6822a7a1237d0274ac68b9e713db11c45a737998 |
Here's the glibc commit that adds reallocarray to glibc:
https://sourceware.org/git/?p=glibc.git;a=commit;h=2e0bbbfbf95fc9e22692e93658a6fbdd2d4554da
The reallocarray symbol is declared in both stdlib.h and malloc.h.
Fix #176072 files changed, 12 insertions(+), 0 deletions(-)
lib/libc/include/generic-glibc/malloc.h+6| ... | ... | @@ -51,6 +51,11 @@ __THROW __attribute_malloc__ __attribute_alloc_size__ ((1, 2)) __wur; |
| 51 | 51 | extern void *realloc (void *__ptr, size_t __size) |
| 52 | 52 | __THROW __attribute_warn_unused_result__ __attribute_alloc_size__ ((2)); |
| 53 | 53 | |
| 54 | /* | |
| 55 | * reallocarray introduced in glibc 2.26 | |
| 56 | * https://sourceware.org/git/?p=glibc.git;a=commit;h=2e0bbbfbf95fc9e22692e93658a6fbdd2d4554da | |
| 57 | */ | |
| 58 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 26) || __GLIBC__ > 2 | |
| 54 | 59 | /* Re-allocate the previously allocated block in PTR, making the new |
| 55 | 60 | block large enough for NMEMB elements of SIZE bytes each. */ |
| 56 | 61 | /* __attribute_malloc__ is not used, because if reallocarray returns |
| ... | ... | @@ -59,6 +64,7 @@ __THROW __attribute_warn_unused_result__ __attribute_alloc_size__ ((2)); |
| 59 | 64 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size) |
| 60 | 65 | __THROW __attribute_warn_unused_result__ __attribute_alloc_size__ ((2, 3)) |
| 61 | 66 | __attr_dealloc_free; |
| 67 | #endif /* glibc v2.26 and later */ | |
| 62 | 68 | |
| 63 | 69 | /* Free a block allocated by `malloc', `realloc' or `calloc'. */ |
| 64 | 70 | extern void free (void *__ptr) __THROW; |
lib/libc/include/generic-glibc/stdlib.h+6| ... | ... | @@ -686,6 +686,11 @@ extern void *realloc (void *__ptr, size_t __size) |
| 686 | 686 | /* Free a block allocated by `malloc', `realloc' or `calloc'. */ |
| 687 | 687 | extern void free (void *__ptr) __THROW; |
| 688 | 688 | |
| 689 | /* | |
| 690 | * reallocarray introduced in glibc 2.26 | |
| 691 | * https://sourceware.org/git/?p=glibc.git;a=commit;h=2e0bbbfbf95fc9e22692e93658a6fbdd2d4554da | |
| 692 | */ | |
| 693 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 26) || __GLIBC__ > 2 | |
| 689 | 694 | #ifdef __USE_MISC |
| 690 | 695 | /* Re-allocate the previously allocated block in PTR, making the new |
| 691 | 696 | block large enough for NMEMB elements of SIZE bytes each. */ |
| ... | ... | @@ -701,6 +706,7 @@ extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size) |
| 701 | 706 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size) |
| 702 | 707 | __THROW __attr_dealloc (reallocarray, 1); |
| 703 | 708 | #endif |
| 709 | #endif /* glibc v2.26 and later */ | |
| 704 | 710 | |
| 705 | 711 | #ifdef __USE_MISC |
| 706 | 712 | # include <alloca.h> |