☠☠ backed out by b068b0194348 ☠ ☠ | |
author | Shelly Lin <slin@mozilla.com> |
Fri, 17 Jan 2014 16:54:06 +0800 | |
changeset 164080 | 4230d328b65f25ca7398a9da4b2ff345e0600d6d |
parent 164079 | 58c2a13fe0d5f91ddae61ae36c9cf0d9844ba60e |
child 164081 | 8c9e9d8c4c758156ae52609c25ed8090687db4a8 |
push id | 26026 |
push user | philringnalda@gmail.com |
push date | Sat, 18 Jan 2014 23:17:27 +0000 |
treeherder | mozilla-central@61fd0f987cf2 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | glandium |
bugs | 801571 |
milestone | 29.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/configure.in +++ b/configure.in @@ -7069,16 +7069,17 @@ MOZ_ARG_ENABLE_BOOL(wrap-malloc, _WRAP_MALLOC=1, _WRAP_MALLOC= ) if test -n "$_WRAP_MALLOC"; then if test -n "$GNU_CC"; then WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign" WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete" WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup" + WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=vasprintf,--wrap=asprintf" WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size" dnl Wrap operator new and operator delete on Android. if test "$OS_TARGET" = "Android"; then WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv" dnl Wrap the nothrow variants too. WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_ZnwjRKSt9nothrow_t,--wrap=_ZnajRKSt9nothrow_t,--wrap=_ZdlPvRKSt9nothrow_t,--wrap=_ZdaPvRKSt9nothrow_t" fi else
--- a/memory/build/mozmemory_wrap.c +++ b/memory/build/mozmemory_wrap.c @@ -83,16 +83,61 @@ strndup_impl(const char *src, size_t len MOZ_MEMORY_API char * strdup_impl(const char *src) { size_t len = strlen(src); return strndup_impl(src, len); } #endif /* XP_DARWIN */ +#ifdef ANDROID +#include <stdarg.h> + +MOZ_MEMORY_API int +vasprintf_impl(char **str, const char *fmt, va_list ap) +{ + if (str == NULL || fmt == NULL) { + return -1; + } + + char* ptr = (char*)malloc_impl(128); + if (ptr == NULL) { + return -1; + } + + int ret = vsnprintf(ptr, 128, fmt, ap); + if (ret < 0) { + free_impl(ptr); + return ret; + } + + char* _ptr = realloc_impl(ptr, ret + 1); + if (_ptr == NULL) { + return -1; + } + + *str = _ptr; + + return ret; +} + +MOZ_MEMORY_API int +asprintf_impl(char **str, const char *fmt, ...) + { + va_list ap; + va_start(ap, fmt); + + int ret = vasprintf_impl(str, fmt, ap); + + va_end(ap); + + return ret; +} +#endif + #ifdef XP_WIN /* * There's a fun allocator mismatch in (at least) the VS 2010 CRT * (see the giant comment in $(topsrcdir)/mozglue/build/Makefile.in) * that gets redirected here to avoid a crash on shutdown. */ void dumb_free_thunk(void *ptr)
--- a/memory/build/mozmemory_wrap.h +++ b/memory/build/mozmemory_wrap.h @@ -207,14 +207,23 @@ /* Duplication functions */ #define strndup_impl mozmem_dup_impl(strndup) #define strdup_impl mozmem_dup_impl(strdup) #ifdef XP_WIN # define wcsdup_impl mozmem_dup_impl(wcsdup) #endif +/* String functions */ +#ifdef ANDROID +/* Bug 801571 and Bug 879668, libstagefright uses vasprintf, causing malloc()/ + * free() to be mismatched between bionic and mozglue implementation. + */ +#define vasprintf_impl mozmem_dup_impl(vasprintf) +#define asprintf_impl mozmem_dup_impl(asprintf) +#endif + /* Jemalloc specific function */ #define jemalloc_stats_impl mozmem_jemalloc_impl(jemalloc_stats) #define jemalloc_purge_freed_pages_impl mozmem_jemalloc_impl(jemalloc_purge_freed_pages) #define jemalloc_free_dirty_pages_impl mozmem_jemalloc_impl(jemalloc_free_dirty_pages) #endif /* mozmemory_wrap_h */