X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/ceeb3d7db5c33884003f280ddfaa1c50a70cc7ad..8d50508a88ff3aba8dd08209c00782d3e73a569e:/src/gmalloc.c diff --git a/src/gmalloc.c b/src/gmalloc.c index 3508304da3..99fa36d073 100644 --- a/src/gmalloc.c +++ b/src/gmalloc.c @@ -36,8 +36,9 @@ Cambridge, MA 02139, USA. #include #endif -#if defined __cplusplus || (defined (__STDC__) && __STDC__) || \ - defined STDC_HEADERS || defined PROTOTYPES +#if ((defined __cplusplus || (defined (__STDC__) && __STDC__) \ + || defined STDC_HEADERS || defined PROTOTYPES) \ + && ! defined (BROKEN_PROTOTYPES)) #undef PP #define PP(args) args #undef __ptr_t @@ -84,7 +85,15 @@ extern "C" #define __malloc_size_t size_t #define __malloc_ptrdiff_t ptrdiff_t #else +#ifdef __GNUC__ +#include +#ifdef __SIZE_TYPE__ +#define __malloc_size_t __SIZE_TYPE__ +#endif +#endif +#ifndef __malloc_size_t #define __malloc_size_t unsigned int +#endif #define __malloc_ptrdiff_t int #endif @@ -411,7 +420,7 @@ protect_malloc_state (protect_p) last_state_size = _heaplimit * sizeof *_heapinfo; last_heapinfo = _heapinfo; - + if (protect_p != state_protected_p) { state_protected_p = protect_p; @@ -983,7 +992,7 @@ _free_internal (ptr) return; PROTECT_MALLOC_STATE (0); - + for (l = _aligned_blocks; l != NULL; l = l->next) if (l->aligned == ptr) { @@ -1205,7 +1214,7 @@ _free_internal (ptr) } break; } - + PROTECT_MALLOC_STATE (1); } @@ -1371,7 +1380,7 @@ _realloc_internal (ptr, size) block = BLOCK (ptr); PROTECT_MALLOC_STATE (0); - + type = _heapinfo[block].busy.type; switch (type) { @@ -1597,7 +1606,8 @@ Cambridge, MA 02139, USA. */ #else -__ptr_t (*__memalign_hook) PP ((size_t __size, size_t __alignment)); +__ptr_t (*__memalign_hook) PP ((__malloc_size_t __size, + __malloc_size_t __alignment)); __ptr_t memalign (alignment, size) @@ -1833,7 +1843,7 @@ freehook (ptr) __ptr_t ptr; { struct hdr *hdr; - + if (ptr) { hdr = ((struct hdr *) ptr) - 1; @@ -1843,7 +1853,7 @@ freehook (ptr) } else hdr = NULL; - + __free_hook = old_free_hook; free (hdr); __free_hook = freehook; @@ -1877,7 +1887,7 @@ reallochook (ptr, size) { struct hdr *hdr = NULL; __malloc_size_t osize = 0; - + if (ptr) { hdr = ((struct hdr *) ptr) - 1; @@ -1887,7 +1897,7 @@ reallochook (ptr, size) if (size < osize) flood ((char *) ptr + size, FREEFLOOD, osize - size); } - + __free_hook = old_free_hook; __malloc_hook = old_malloc_hook; __realloc_hook = old_realloc_hook; @@ -1968,3 +1978,6 @@ mprobe (__ptr_t ptr) } #endif /* GC_MCHECK */ + +/* arch-tag: 93dce5c0-f49a-41b5-86b1-f91c4169c02e + (do not change this comment) */