Bug 1368932 - Fill the replace-malloc malloc_table_t with the real allocator as a fallback. r=njn

Until now, the malloc implementation functions would call the
replace-malloc functions if they exist, and fallback to the real
allocator in no such function exists. Instead of doing this, we now
fill the empty slots in the malloc_table_t with the real allocator
functions.

--HG--
extra : rebase_source : b54634f23188906939e4dc01fc5a3007de0f3f2c
This commit is contained in:
Mike Hommey 2017-05-30 15:57:28 +09:00
Родитель 1a6ac2f8fb
Коммит 565f74102e
1 изменённых файлов: 7 добавлений и 5 удалений

Просмотреть файл

@ -129,6 +129,12 @@ replace_malloc_init_funcs()
replace_malloc_table.name = REPLACE_MALLOC_GET_FUNC(handle, name);
#include "malloc_decls.h"
}
#define MALLOC_DECL(name, ...) \
if (!replace_malloc_table.name) { \
replace_malloc_table.name = je_ ## name; \
}
#include "malloc_decls.h"
}
/*
@ -174,11 +180,7 @@ init()
{ \
if (MOZ_UNLIKELY(!replace_malloc_initialized)) \
init(); \
if (MOZ_LIKELY(!replace_malloc_table.name)) { \
return je_ ## name(ARGS_HELPER(ARGS, ##__VA_ARGS__)); \
} else { \
return replace_malloc_table.name(ARGS_HELPER(ARGS, ##__VA_ARGS__)); \
} \
return replace_malloc_table.name(ARGS_HELPER(ARGS, ##__VA_ARGS__)); \
}
#define GENERIC_MALLOC_DECL(name, return_type, ...) \