diff options
author | Joseph Myers <joseph@codesourcery.com> | 2013-03-08 21:27:42 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2013-03-08 21:27:42 +0000 |
commit | a222d91a13149b7034226ff35c55760989089cbd (patch) | |
tree | 1c2ecae0c9cd09dcafd47216d7eed8a6e41a1731 | |
parent | 5cc45e102bdc19dec494e4ae8f0eb832f11af3e5 (diff) | |
download | glibc-a222d91a13149b7034226ff35c55760989089cbd.tar.gz glibc-a222d91a13149b7034226ff35c55760989089cbd.tar.xz glibc-a222d91a13149b7034226ff35c55760989089cbd.zip |
Remove __malloc_ptr_t.
-rw-r--r-- | ChangeLog | 29 | ||||
-rw-r--r-- | malloc/arena.c | 8 | ||||
-rw-r--r-- | malloc/hooks.c | 6 | ||||
-rw-r--r-- | malloc/malloc.c | 38 | ||||
-rw-r--r-- | malloc/malloc.h | 9 | ||||
-rw-r--r-- | malloc/morecore.c | 8 |
6 files changed, 62 insertions, 36 deletions
diff --git a/ChangeLog b/ChangeLog index 651374bbb5..a86ce03a76 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,34 @@ 2013-03-08 Joseph Myers <joseph@codesourcery.com> + * malloc/malloc.h (__malloc_ptr_t): Remove macro. + (__free_hook): Use void * instead of __malloc_ptr_t. + (__malloc_hook): Likewise. + (__realloc_hook): Likewise. + (__memalign_hook): Likewise. + (__after_morecore_hook): Likewise. + * malloc/arena.c (save_malloc_hook): Likewise. + (save_free_hook): Likewise. + * malloc/hooks.c (malloc_hook_ini): Likewise. + (realloc_hook_ini): Likewise. + (memalign_hook_ini): Likewise. + * malloc/malloc.c (malloc_hook_ini): Likewise. + (realloc_hook_ini): Likewise. + (memalign_hook_ini): Likewise. + (__free_hook): Likewise. + (__malloc_hook): Likewise. + (__realloc_hook): Likewise. + (__memalign_hook): Likewise. + (__libc_malloc): Likewise. + (__libc_free): Likewise. + (__libc_realloc): Likewise. + (__libc_memalign): Likewise. + (__libc_valloc): Likewise. + (__libc_pvalloc): Likewise. + (__libc_calloc): Likewise. + (__posix_memalign): Likewise. + * malloc/morecore.c (__sbrk): Likewise. + (__default_morecore): Likewise. + * malloc/morecore.c (__default_morecore): Use ISO C prototype. * malloc/malloc.h (__malloc_ptrdiff_t): Remove macro. diff --git a/malloc/arena.c b/malloc/arena.c index 7d51a9dd14..12a48ad7ba 100644 --- a/malloc/arena.c +++ b/malloc/arena.c @@ -144,11 +144,9 @@ int __malloc_initialized = -1; /* atfork support. */ -static __malloc_ptr_t (*save_malloc_hook) (size_t __size, - const __malloc_ptr_t); -static void (*save_free_hook) (__malloc_ptr_t __ptr, - const __malloc_ptr_t); -static void* save_arena; +static void *(*save_malloc_hook) (size_t __size, const void *); +static void (*save_free_hook) (void *__ptr, const void *); +static void *save_arena; #ifdef ATFORK_MEM ATFORK_MEM; diff --git a/malloc/hooks.c b/malloc/hooks.c index 05cc35e849..8e4a6ed033 100644 --- a/malloc/hooks.c +++ b/malloc/hooks.c @@ -25,7 +25,7 @@ initialization routine, then do the normal work. */ static void* -malloc_hook_ini(size_t sz, const __malloc_ptr_t caller) +malloc_hook_ini(size_t sz, const void *caller) { __malloc_hook = NULL; ptmalloc_init(); @@ -33,7 +33,7 @@ malloc_hook_ini(size_t sz, const __malloc_ptr_t caller) } static void* -realloc_hook_ini(void* ptr, size_t sz, const __malloc_ptr_t caller) +realloc_hook_ini(void* ptr, size_t sz, const void *caller) { __malloc_hook = NULL; __realloc_hook = NULL; @@ -42,7 +42,7 @@ realloc_hook_ini(void* ptr, size_t sz, const __malloc_ptr_t caller) } static void* -memalign_hook_ini(size_t alignment, size_t sz, const __malloc_ptr_t caller) +memalign_hook_ini(size_t alignment, size_t sz, const void *caller) { __memalign_hook = NULL; ptmalloc_init(); diff --git a/malloc/malloc.c b/malloc/malloc.c index bbb035393f..70b9329cc3 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -1841,22 +1841,22 @@ static void malloc_consolidate(mstate); /* Forward declarations. */ static void* malloc_hook_ini (size_t sz, - const __malloc_ptr_t caller) __THROW; + const void *caller) __THROW; static void* realloc_hook_ini (void* ptr, size_t sz, - const __malloc_ptr_t caller) __THROW; + const void *caller) __THROW; static void* memalign_hook_ini (size_t alignment, size_t sz, - const __malloc_ptr_t caller) __THROW; + const void *caller) __THROW; void weak_variable (*__malloc_initialize_hook) (void) = NULL; -void weak_variable (*__free_hook) (__malloc_ptr_t __ptr, - const __malloc_ptr_t) = NULL; -__malloc_ptr_t weak_variable (*__malloc_hook) - (size_t __size, const __malloc_ptr_t) = malloc_hook_ini; -__malloc_ptr_t weak_variable (*__realloc_hook) - (__malloc_ptr_t __ptr, size_t __size, const __malloc_ptr_t) +void weak_variable (*__free_hook) (void *__ptr, + const void *) = NULL; +void *weak_variable (*__malloc_hook) + (size_t __size, const void *) = malloc_hook_ini; +void *weak_variable (*__realloc_hook) + (void *__ptr, size_t __size, const void *) = realloc_hook_ini; -__malloc_ptr_t weak_variable (*__memalign_hook) - (size_t __alignment, size_t __size, const __malloc_ptr_t) +void *weak_variable (*__memalign_hook) + (size_t __alignment, size_t __size, const void *) = memalign_hook_ini; void weak_variable (*__after_morecore_hook) (void) = NULL; @@ -2842,7 +2842,7 @@ __libc_malloc(size_t bytes) mstate ar_ptr; void *victim; - __malloc_ptr_t (*hook) (size_t, const __malloc_ptr_t) + void *(*hook) (size_t, const void *) = force_reg (__malloc_hook); if (__builtin_expect (hook != NULL, 0)) return (*hook)(bytes, RETURN_ADDRESS (0)); @@ -2873,7 +2873,7 @@ __libc_free(void* mem) mstate ar_ptr; mchunkptr p; /* chunk corresponding to mem */ - void (*hook) (__malloc_ptr_t, const __malloc_ptr_t) + void (*hook) (void *, const void *) = force_reg (__free_hook); if (__builtin_expect (hook != NULL, 0)) { (*hook)(mem, RETURN_ADDRESS (0)); @@ -2912,7 +2912,7 @@ __libc_realloc(void* oldmem, size_t bytes) void* newp; /* chunk to return */ - __malloc_ptr_t (*hook) (__malloc_ptr_t, size_t, const __malloc_ptr_t) = + void *(*hook) (void *, size_t, const void *) = force_reg (__realloc_hook); if (__builtin_expect (hook != NULL, 0)) return (*hook)(oldmem, bytes, RETURN_ADDRESS (0)); @@ -3004,7 +3004,7 @@ __libc_memalign(size_t alignment, size_t bytes) mstate ar_ptr; void *p; - __malloc_ptr_t (*hook) (size_t, size_t, const __malloc_ptr_t) = + void *(*hook) (size_t, size_t, const void *) = force_reg (__memalign_hook); if (__builtin_expect (hook != NULL, 0)) return (*hook)(alignment, bytes, RETURN_ADDRESS (0)); @@ -3046,7 +3046,7 @@ __libc_valloc(size_t bytes) size_t pagesz = GLRO(dl_pagesize); - __malloc_ptr_t (*hook) (size_t, size_t, const __malloc_ptr_t) = + void *(*hook) (size_t, size_t, const void *) = force_reg (__memalign_hook); if (__builtin_expect (hook != NULL, 0)) return (*hook)(pagesz, bytes, RETURN_ADDRESS (0)); @@ -3082,7 +3082,7 @@ __libc_pvalloc(size_t bytes) size_t page_mask = GLRO(dl_pagesize) - 1; size_t rounded_bytes = (bytes + page_mask) & ~(page_mask); - __malloc_ptr_t (*hook) (size_t, size_t, const __malloc_ptr_t) = + void *(*hook) (size_t, size_t, const void *) = force_reg (__memalign_hook); if (__builtin_expect (hook != NULL, 0)) return (*hook)(pagesz, rounded_bytes, RETURN_ADDRESS (0)); @@ -3125,7 +3125,7 @@ __libc_calloc(size_t n, size_t elem_size) } } - __malloc_ptr_t (*hook) (size_t, const __malloc_ptr_t) = + void *(*hook) (size_t, const void *) = force_reg (__malloc_hook); if (__builtin_expect (hook != NULL, 0)) { sz = bytes; @@ -4916,7 +4916,7 @@ __posix_memalign (void **memptr, size_t alignment, size_t size) /* Call the hook here, so that caller is posix_memalign's caller and not posix_memalign itself. */ - __malloc_ptr_t (*hook) (size_t, size_t, const __malloc_ptr_t) = + void *(*hook) (size_t, size_t, const void *) = force_reg (__memalign_hook); if (__builtin_expect (hook != NULL, 0)) mem = (*hook)(alignment, size, RETURN_ADDRESS (0)); diff --git a/malloc/malloc.h b/malloc/malloc.h index cd691f103c..b8b0ca34ca 100644 --- a/malloc/malloc.h +++ b/malloc/malloc.h @@ -22,7 +22,6 @@ #include <features.h> #include <stddef.h> #include <stdio.h> -# define __malloc_ptr_t void * #ifdef _LIBC # define __MALLOC_HOOK_VOLATILE @@ -149,18 +148,18 @@ extern void (*__MALLOC_HOOK_VOLATILE __malloc_initialize_hook) (void) __MALLOC_DEPRECATED; /* Hooks for debugging and user-defined versions. */ extern void (*__MALLOC_HOOK_VOLATILE __free_hook) (void *__ptr, - const __malloc_ptr_t) + const void *) __MALLOC_DEPRECATED; extern void *(*__MALLOC_HOOK_VOLATILE __malloc_hook) (size_t __size, - const __malloc_ptr_t) + const void *) __MALLOC_DEPRECATED; extern void *(*__MALLOC_HOOK_VOLATILE __realloc_hook) (void *__ptr, size_t __size, - const __malloc_ptr_t) + const void *) __MALLOC_DEPRECATED; extern void *(*__MALLOC_HOOK_VOLATILE __memalign_hook) (size_t __alignment, size_t __size, - const __malloc_ptr_t) + const void *) __MALLOC_DEPRECATED; extern void (*__MALLOC_HOOK_VOLATILE __after_morecore_hook) (void); diff --git a/malloc/morecore.c b/malloc/morecore.c index e391732b3d..0a644c36ad 100644 --- a/malloc/morecore.c +++ b/malloc/morecore.c @@ -30,7 +30,7 @@ #include <stddef.h> #include <stdlib.h> -extern __malloc_ptr_t __sbrk (ptrdiff_t increment) __THROW; +extern void *__sbrk (ptrdiff_t increment) __THROW; libc_hidden_proto (__sbrk) #endif @@ -41,11 +41,11 @@ libc_hidden_proto (__sbrk) /* Allocate INCREMENT more bytes of data space, and return the start of data space, or NULL on errors. If INCREMENT is negative, shrink data space. */ -__malloc_ptr_t +void * __default_morecore (ptrdiff_t increment) { - __malloc_ptr_t result = (__malloc_ptr_t) __sbrk (increment); - if (result == (__malloc_ptr_t) -1) + void *result = (void *) __sbrk (increment); + if (result == (void *) -1) return NULL; return result; } |