b=511568; WinCE shunt not overriding std::nothrow operator new; r=blassey

This commit is contained in:
Vladimir Vukicevic 2009-08-20 18:46:34 -07:00
parent 9fae068e97
commit 632d2bb1ff
3 changed files with 54 additions and 22 deletions

View File

@ -54,11 +54,53 @@ typedef unsigned short wchar_t;
#ifdef MOZ_MEMORY
#ifdef __cplusplus
// define these so we don't include <new> from either VC or
// the CE5 SDK
#define _NEW_
void * operator new(size_t _Size);
void operator delete(void * ptr);
void *operator new[](size_t size);
void operator delete[](void *ptr);
#define _INC_NEW
#ifndef __NOTHROW_T_DEFINED
#define __NOTHROW_T_DEFINED
namespace std {
struct nothrow_t {};
extern const nothrow_t nothrow;
};
#endif
// grab malloc and free prototypes
#include "jemalloc.h"
// Normal and nothrow versions of operator new, none of which
// actually throw for us. These are both inline and exported
// from the shunt.
inline void *operator new(size_t size) throw() {
return (void*) malloc(size);
}
inline void *operator new(size_t size, const std::nothrow_t&) throw() {
return (void*) malloc(size);
}
inline void operator delete(void *ptr) throw() {
free(ptr);
}
inline void *operator new[](size_t size) throw() {
return (void*) malloc(size);
}
inline void *operator new[](size_t size, const std::nothrow_t&) throw() {
return (void*) malloc(size);
}
inline void operator delete[](void *ptr) throw() {
return free(ptr);
}
// Placement new. Just inline, not exported (which doesn't work for
// some reason, but it's a noop in any case)
inline void *operator new(size_t, void *p) {
return p;
}
inline void *operator new[](size_t, void *p) {
return p;
}
extern "C" {
#endif

View File

@ -40,25 +40,9 @@
#include <stdlib.h>
#ifdef MOZ_MEMORY
void * operator new(size_t _Size)
{
void *p = malloc(_Size);
return (p);
}
void operator delete(void * ptr)
{
free(ptr);
}
void *operator new[](size_t size)
{
void* p = malloc(size);
return (p);
}
void operator delete[](void *ptr)
{
free(ptr);
}
// declare the nothrow object
const std::nothrow_t std::nothrow;
char*
_strndup(const char *src, size_t len) {

View File

@ -24,12 +24,18 @@ strftime
time
#ifdef MOZ_MEMORY
;; std::nothrow object
?nothrow@std@@3Unothrow_t@1@B
;; operator new
??2@YAPAXI@Z
;; operator new nothrow
??2@YAPAXIABUnothrow_t@std@@@Z
;; operator delete
??3@YAXPAX@Z
;; operator new[]
??_U@YAPAXI@Z
;; operator new[] nothrow
??_U@YAPAXIABUnothrow_t@std@@@Z
;; operator delete[]
??_V@YAXPAX@Z
malloc