diff options
Diffstat (limited to 'malloc/mcheck.c')
-rw-r--r-- | malloc/mcheck.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/malloc/mcheck.c b/malloc/mcheck.c index 5128d687fa..e195861c98 100644 --- a/malloc/mcheck.c +++ b/malloc/mcheck.c @@ -28,12 +28,12 @@ #endif /* Old hook values. */ -static void (*old_free_hook)(__ptr_t ptr, const __ptr_t); -static __ptr_t (*old_malloc_hook) (size_t size, const __ptr_t); -static __ptr_t (*old_memalign_hook) (size_t alignment, size_t size, - const __ptr_t); -static __ptr_t (*old_realloc_hook) (__ptr_t ptr, size_t size, - const __ptr_t); +static void (*old_free_hook)(void *ptr, const void *); +static void *(*old_malloc_hook) (size_t size, const void *); +static void *(*old_memalign_hook) (size_t alignment, size_t size, + const void *); +static void *(*old_realloc_hook) (void *ptr, size_t size, + const void *); /* Function to call when something awful happens. */ static void (*abortfunc) (enum mcheck_status); @@ -51,7 +51,7 @@ struct hdr unsigned long int magic; /* Magic number to check header integrity. */ struct hdr *prev; struct hdr *next; - __ptr_t block; /* Real block allocated, for memalign. */ + void *block; /* Real block allocated, for memalign. */ unsigned long int magic2; /* Extra, keeps us doubleword aligned. */ }; @@ -68,9 +68,9 @@ static int pedantic; # include <string.h> # define flood memset #else -static void flood (__ptr_t, int, size_t); +static void flood (void *, int, size_t); static void -flood (__ptr_t ptr, int val, size_t size) +flood (void *ptr, int val, size_t size) { char *cp = ptr; while (size--) @@ -174,7 +174,7 @@ link_blk (struct hdr *hdr) } } static void -freehook (__ptr_t ptr, const __ptr_t caller) +freehook (void *ptr, const void *caller) { if (pedantic) mcheck_check_all (); @@ -197,8 +197,8 @@ freehook (__ptr_t ptr, const __ptr_t caller) __free_hook = freehook; } -static __ptr_t -mallochook (size_t size, const __ptr_t caller) +static void * +mallochook (size_t size, const void *caller) { struct hdr *hdr; @@ -226,13 +226,13 @@ mallochook (size_t size, const __ptr_t caller) hdr->block = hdr; hdr->magic2 = (uintptr_t) hdr ^ MAGICWORD; ((char *) &hdr[1])[size] = MAGICBYTE; - flood ((__ptr_t) (hdr + 1), MALLOCFLOOD, size); - return (__ptr_t) (hdr + 1); + flood ((void *) (hdr + 1), MALLOCFLOOD, size); + return (void *) (hdr + 1); } -static __ptr_t +static void * memalignhook (size_t alignment, size_t size, - const __ptr_t caller) + const void *caller) { struct hdr *hdr; size_t slop; @@ -262,15 +262,15 @@ memalignhook (size_t alignment, size_t size, hdr->size = size; link_blk (hdr); - hdr->block = (__ptr_t) block; + hdr->block = (void *) block; hdr->magic2 = (uintptr_t) block ^ MAGICWORD; ((char *) &hdr[1])[size] = MAGICBYTE; - flood ((__ptr_t) (hdr + 1), MALLOCFLOOD, size); - return (__ptr_t) (hdr + 1); + flood ((void *) (hdr + 1), MALLOCFLOOD, size); + return (void *) (hdr + 1); } -static __ptr_t -reallochook (__ptr_t ptr, size_t size, const __ptr_t caller) +static void * +reallochook (void *ptr, size_t size, const void *caller) { if (size == 0) { @@ -310,11 +310,11 @@ reallochook (__ptr_t ptr, size_t size, const __ptr_t caller) __memalign_hook = old_memalign_hook; __realloc_hook = old_realloc_hook; if (old_realloc_hook != NULL) - hdr = (struct hdr *) (*old_realloc_hook)((__ptr_t) hdr, + hdr = (struct hdr *) (*old_realloc_hook)((void *) hdr, sizeof (struct hdr) + size + 1, caller); else - hdr = (struct hdr *) realloc ((__ptr_t) hdr, + hdr = (struct hdr *) realloc ((void *) hdr, sizeof (struct hdr) + size + 1); __free_hook = freehook; __malloc_hook = mallochook; @@ -330,7 +330,7 @@ reallochook (__ptr_t ptr, size_t size, const __ptr_t caller) ((char *) &hdr[1])[size] = MAGICBYTE; if (size > osize) flood ((char *) (hdr + 1) + osize, MALLOCFLOOD, size - osize); - return (__ptr_t) (hdr + 1); + return (void *) (hdr + 1); } __attribute__ ((noreturn)) @@ -410,7 +410,7 @@ mcheck_pedantic (void (*func) (enum mcheck_status)) } enum mcheck_status -mprobe (__ptr_t ptr) +mprobe (void *ptr) { return mcheck_used ? checkhdr (((struct hdr *) ptr) - 1) : MCHECK_DISABLED; } |