summaryrefslogtreecommitdiff
path: root/malloc/hooks.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-02-07 22:01:49 +0000
committerUlrich Drepper <drepper@redhat.com>2009-02-07 22:01:49 +0000
commit78ac92ad8d6c97c57d09bef01608622706b24f65 (patch)
treee012386e36d8768df6812074fb62b2450aebe6bc /malloc/hooks.c
parent7dddb4bd1e22d8aa3cb2af9f5116ceec394d2d44 (diff)
downloadglibc-78ac92ad8d6c97c57d09bef01608622706b24f65.tar.gz
* malloc/malloc.c (_int_free): Second argument is now mchunkptr.
Change all callers. (_int_realloc): Likewise. All _int_* functions are now static. * malloc/hooks.c: Change all callers to _int_free and _int_realloc. * malloc/arena.c: Likewise. * include/malloc.h: Remove now unnecessary declarations of the _int_* functions.
Diffstat (limited to 'malloc/hooks.c')
-rw-r--r--malloc/hooks.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/malloc/hooks.c b/malloc/hooks.c
index c88937665c..537995aeab 100644
--- a/malloc/hooks.c
+++ b/malloc/hooks.c
@@ -1,5 +1,5 @@
/* Malloc implementation for multiple threads without lock contention.
- Copyright (C) 2001-2006, 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2001-2006, 2007, 2008, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Wolfram Gloger <wg@malloc.de>, 2001.
@@ -293,7 +293,7 @@ free_check(mem, caller) Void_t* mem; const Void_t *caller;
#if 0 /* Erase freed memory. */
memset(mem, 0, chunksize(p) - (SIZE_SZ+1));
#endif
- _int_free(&main_arena, mem);
+ _int_free(&main_arena, p);
(void)mutex_unlock(&main_arena.mutex);
}
@@ -305,8 +305,7 @@ realloc_check(oldmem, bytes, caller)
Void_t* oldmem; size_t bytes; const Void_t *caller;
#endif
{
- mchunkptr oldp;
- INTERNAL_SIZE_T nb, oldsize;
+ INTERNAL_SIZE_T nb;
Void_t* newmem = 0;
unsigned char *magic_p;
@@ -320,13 +319,13 @@ realloc_check(oldmem, bytes, caller)
return NULL;
}
(void)mutex_lock(&main_arena.mutex);
- oldp = mem2chunk_check(oldmem, &magic_p);
+ const mchunkptr oldp = mem2chunk_check(oldmem, &magic_p);
(void)mutex_unlock(&main_arena.mutex);
if(!oldp) {
malloc_printerr(check_action, "realloc(): invalid pointer", oldmem);
return malloc_check(bytes, NULL);
}
- oldsize = chunksize(oldp);
+ const INTERNAL_SIZE_T oldsize = chunksize(oldp);
checked_request2size(bytes+1, nb);
(void)mutex_lock(&main_arena.mutex);
@@ -356,7 +355,7 @@ realloc_check(oldmem, bytes, caller)
} else {
#endif /* HAVE_MMAP */
if (top_check() >= 0)
- newmem = _int_realloc(&main_arena, oldmem, bytes+1);
+ newmem = _int_realloc(&main_arena, oldp, bytes+1);
#if 0 /* Erase freed memory. */
if(newmem)
newp = mem2chunk(newmem);
@@ -470,7 +469,7 @@ free_starter(mem, caller) Void_t* mem; const Void_t *caller;
return;
}
#endif
- _int_free(&main_arena, mem);
+ _int_free(&main_arena, p);
}
# endif /* !defiend NO_STARTER */