123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- #ifndef _MALLOC_H
- #define _MALLOC_H 1
- #include <features.h>
- #if defined(__STDC__) || defined (__cplusplus)
- # include <stddef.h>
- # define __malloc_ptr_t void *
- #else
- # undef size_t
- # define size_t unsigned int
- # undef ptrdiff_t
- # define ptrdiff_t int
- # define __malloc_ptr_t char *
- #endif
- #ifdef _LIBC
- # define __malloc_size_t size_t
- # define __malloc_ptrdiff_t ptrdiff_t
- #elif !defined __attribute_malloc__
- # define __attribute_malloc__
- #endif
- #ifdef __GNUC__
- #ifndef __THROW
- # if defined __cplusplus && (__GNUC__ >= 3 || __GNUC_MINOR__ >= 8)
- # define __THROW throw ()
- # else
- # define __THROW
- # endif
- #endif
- # define __MALLOC_P(args) args __THROW
- # define __MALLOC_PMT(args) args
- #else
- # define __THROW
- # if (defined __STDC__ && __STDC__) || defined __cplusplus
- # define __MALLOC_P(args) args
- # define __MALLOC_PMT(args) args
- # else
- # define __MALLOC_P(args) ()
- # define __MALLOC_PMT(args) ()
- # endif
- #endif
- #ifndef NULL
- # ifdef __cplusplus
- # define NULL 0
- # else
- # define NULL ((__malloc_ptr_t) 0)
- # endif
- #endif
- #ifdef __cplusplus
- extern "C" {
- #endif
- extern __malloc_ptr_t malloc __MALLOC_P ((size_t __size)) __attribute_malloc__;
- extern __malloc_ptr_t calloc __MALLOC_P ((size_t __nmemb, size_t __size))
- __attribute_malloc__;
- extern __malloc_ptr_t realloc __MALLOC_P ((__malloc_ptr_t __ptr,
- size_t __size))
- __attribute_malloc__;
- extern void free __MALLOC_P ((__malloc_ptr_t __ptr));
- extern __malloc_ptr_t memalign __MALLOC_P ((size_t __alignment, size_t __size));
- libc_hidden_proto(memalign)
- #ifdef __UCLIBC_SUSV2_LEGACY__
- extern __malloc_ptr_t valloc __MALLOC_P ((size_t __size)) __attribute_malloc__;
- #endif
- #ifdef __MALLOC_STANDARD__
- # ifdef __USE_SVID
- struct mallinfo {
- int arena;
- int ordblks;
- int smblks;
- int hblks;
- int hblkhd;
- int usmblks;
- int fsmblks;
- int uordblks;
- int fordblks;
- int keepcost;
- };
- extern struct mallinfo mallinfo __MALLOC_P ((void));
- libc_hidden_proto(mallinfo)
- # endif
- # ifdef __USE_GNU
- extern int malloc_trim(size_t pad);
- # endif
- #include <stdio.h>
- extern void malloc_stats(void);
- extern size_t malloc_usable_size(void *);
- #ifndef M_MXFAST
- # define M_MXFAST 1
- #endif
- #ifndef M_NLBLKS
- # define M_NLBLKS 2
- #endif
- #ifndef M_GRAIN
- # define M_GRAIN 3
- #endif
- #ifndef M_KEEP
- # define M_KEEP 4
- #endif
- #define M_TRIM_THRESHOLD -1
- #define M_TOP_PAD -2
- #define M_MMAP_THRESHOLD -3
- #define M_MMAP_MAX -4
- #define M_CHECK_ACTION -5
- #define M_PERTURB -6
- extern int mallopt __MALLOC_P ((int __param, int __val));
- #endif
- extern void *__uc_malloc(size_t size);
- libc_hidden_proto(__uc_malloc)
- extern void (*__uc_malloc_failed)(size_t size);
- libc_hidden_proto(__uc_malloc_failed)
- #ifdef __cplusplus
- }
- #endif
- #endif
|