Bug 1400096 - Build mozmemory_wrap as C++. r?njn
And since the build system doesn't handle transitions from foo.c to
foo.cpp properly without a clobber, we work around the issue by
switching to unified sources.
--- a/memory/build/moz.build
+++ b/memory/build/moz.build
@@ -15,19 +15,19 @@ LIBRARY_DEFINES['MOZ_HAS_MOZGLUE'] = Tru
DEFINES['MOZ_MEMORY_IMPL'] = True
if CONFIG['MOZ_REPLACE_MALLOC']:
EXPORTS += [
'replace_malloc.h',
'replace_malloc_bridge.h',
]
-SOURCES += [
+UNIFIED_SOURCES += [
'mozjemalloc.cpp',
- 'mozmemory_wrap.c',
+ 'mozmemory_wrap.cpp',
]
if CONFIG['OS_TARGET'] == 'Darwin' and (CONFIG['MOZ_REPLACE_MALLOC'] or
CONFIG['MOZ_MEMORY']):
SOURCES += [
'zone.c',
]
rename from memory/build/mozmemory_wrap.c
rename to memory/build/mozmemory_wrap.cpp
--- a/memory/build/mozmemory_wrap.c
+++ b/memory/build/mozmemory_wrap.cpp
@@ -109,17 +109,17 @@ vasprintf_impl(char **str, const char *f
ret = vsnprintf(ptr, 128, fmt, ap);
if (ret < 0) {
free_impl(ptr);
*str = NULL;
return -1;
}
- _ptr = realloc_impl(ptr, ret + 1);
+ _ptr = reinterpret_cast<char*>(realloc_impl(ptr, ret + 1));
if (_ptr == NULL) {
free_impl(ptr);
*str = NULL;
return -1;
}
*str = _ptr;