bug 551098 - windows mobile crashes on start up since xmalloc landing r=cjones
--- a/build/wince/shunt/memory.cpp
+++ b/build/wince/shunt/memory.cpp
@@ -34,45 +34,39 @@
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "include/mozce_shunt.h"
#include <stdlib.h>
-#include "mozilla/mozalloc_macro_wrappers.h" /* infallible malloc */
-
#ifdef MOZ_MEMORY
// declare the nothrow object
const std::nothrow_t std::nothrow;
char*
_strndup(const char *src, size_t len) {
char* dst = (char*)malloc(len + 1);
- // FIXME/bug 507249: no need to null-check when infallible
- // allocators are used
if(dst)
strncpy(dst, src, len + 1);
return dst;
}
char*
_strdup(const char *src) {
size_t len = strlen(src);
return _strndup(src, len );
}
wchar_t *
_wcsndup(const wchar_t *src, size_t len) {
wchar_t* dst = (wchar_t*)malloc(sizeof(wchar_t) * (len + 1));
- // FIXME/bug 507249: no need to null-check when infallible
- // allocators are used
if(dst)
wcsncpy(dst, src, len + 1);
return dst;
}
wchar_t *
_wcsdup(const wchar_t *src) {
size_t len = wcslen(src);
--- a/memory/Makefile.in
+++ b/memory/Makefile.in
@@ -42,11 +42,16 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS =
ifdef MOZ_MEMORY
DIRS += jemalloc
endif
+ifdef WINCE
+# mozalloc depends on the shunt
+DIRS += $(DEPTH)/build/wince/shunt
+endif
+
DIRS += mozalloc
include $(topsrcdir)/config/rules.mk
--- a/memory/mozalloc/Makefile.in
+++ b/memory/mozalloc/Makefile.in
@@ -46,20 +46,18 @@ include $(DEPTH)/config/autoconf.mk
VISIBILITY_FLAGS=
MODULE = mozalloc
LIBRARY_NAME = mozalloc
FORCE_SHARED_LIB= 1
DIST_INSTALL = 1
ifeq (,$(filter-out WINCE,$(OS_ARCH)))
-# The wince shunt relies on this library in a somewhat complicated
-# way. In wince builds, jemalloc replaces the wince libc allocators
-# and moz_* will end up using those symbols at run time.
-export NO_SHUNT = 1
+# mozalloc gets its allocation methods from the shunt, which gets their
+# implementation by direcly linking with jemalloc.obj
OS_LIBS =
endif
ifeq (,$(filter-out OS2,$(OS_ARCH)))
# The strndup declaration in string.h is in an ifdef __USE_GNU section
DEFINES += -D_GNU_SOURCE
endif