mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-11-25 08:37:38 +01:00
Add arguments to malloc and calloc prototypes in Ltest-nocalloc
This commit is contained in:
parent
249ff2f840
commit
65f936402d
1 changed files with 5 additions and 5 deletions
|
@ -40,17 +40,17 @@ int in_unwind;
|
||||||
void *
|
void *
|
||||||
calloc(size_t n, size_t s)
|
calloc(size_t n, size_t s)
|
||||||
{
|
{
|
||||||
static void * (*func)();
|
static void * (*func)(size_t, size_t);
|
||||||
|
|
||||||
#ifdef __GLIBC__
|
#ifdef __GLIBC__
|
||||||
/* In glibc, dlsym() calls calloc. Calling dlsym(RTLD_NEXT, "calloc") here
|
/* In glibc, dlsym() calls calloc. Calling dlsym(RTLD_NEXT, "calloc") here
|
||||||
causes infinite recursion. Instead, we simply use it by its other
|
causes infinite recursion. Instead, we simply use it by its other
|
||||||
name. */
|
name. */
|
||||||
extern void *__libc_calloc();
|
extern void *__libc_calloc(size_t, size_t);
|
||||||
func = &__libc_calloc;
|
func = &__libc_calloc;
|
||||||
#else
|
#else
|
||||||
if(!func)
|
if(!func)
|
||||||
func = (void *(*)()) dlsym(RTLD_NEXT, "calloc");
|
func = dlsym(RTLD_NEXT, "calloc");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (in_unwind) {
|
if (in_unwind) {
|
||||||
|
@ -64,10 +64,10 @@ calloc(size_t n, size_t s)
|
||||||
void *
|
void *
|
||||||
malloc(size_t s)
|
malloc(size_t s)
|
||||||
{
|
{
|
||||||
static void * (*func)();
|
static void * (*func)(size_t);
|
||||||
|
|
||||||
if(!func)
|
if(!func)
|
||||||
func = (void *(*)()) dlsym(RTLD_NEXT, "malloc");
|
func = dlsym(RTLD_NEXT, "malloc");
|
||||||
|
|
||||||
if (in_unwind) {
|
if (in_unwind) {
|
||||||
num_mallocs++;
|
num_mallocs++;
|
||||||
|
|
Loading…
Reference in a new issue