Implement operator delete properly; removed dependency on static constructor

This commit is contained in:
kipp%netscape.com 1999-02-26 17:03:18 +00:00
Родитель f76ba9c5e6
Коммит 63f4abfd18
3 изменённых файлов: 60 добавлений и 24 удалений

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

@ -30,6 +30,17 @@
static NS_DEFINE_IID(kIStyleContextIID, NS_ISTYLECONTEXT_IID);
// Default border widths for enumerated values
//
// NOTE: don't use NSIntPointsToTwips here because that results in a
// global constructor been created to do the *runtime* initializing
// because some compilers don't know how to expand inline methods in
// this situation.
static nscoord kBorderWidths[3] = {
nscoord(1 * TWIPS_PER_POINT_INT),
nscoord(3 * TWIPS_PER_POINT_INT),
nscoord(5 * TWIPS_PER_POINT_INT)
};
// --------------------
// nsStyleFont
@ -249,11 +260,6 @@ void nsStyleSpacing::CalcPaddingFor(const nsIFrame* aFrame, nsMargin& aPadding)
}
}
static const nscoord kBorderWidths[3] =
{ NSIntPointsToTwips(1),
NSIntPointsToTwips(3),
NSIntPointsToTwips(5) };
void nsStyleSpacing::CalcBorderFor(const nsIFrame* aFrame, nsMargin& aBorder) const
{
if (mHasCachedBorder) {
@ -685,12 +691,18 @@ public:
nsIPresContext* aPresContext);
virtual ~StyleContextImpl();
void* operator new(size_t sz) {
void* rv = new char[sz];
nsCRT::zero(rv, sz);
void* operator new(size_t size) {
void* rv = ::operator new(size);
if (rv) {
nsCRT::zero(rv, size);
}
return rv;
}
void operator delete(void* ptr, size_t size) {
::operator delete(ptr);
}
NS_DECL_ISUPPORTS
virtual nsIStyleContext* GetParent(void) const;

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

@ -30,6 +30,17 @@
static NS_DEFINE_IID(kIStyleContextIID, NS_ISTYLECONTEXT_IID);
// Default border widths for enumerated values
//
// NOTE: don't use NSIntPointsToTwips here because that results in a
// global constructor been created to do the *runtime* initializing
// because some compilers don't know how to expand inline methods in
// this situation.
static nscoord kBorderWidths[3] = {
nscoord(1 * TWIPS_PER_POINT_INT),
nscoord(3 * TWIPS_PER_POINT_INT),
nscoord(5 * TWIPS_PER_POINT_INT)
};
// --------------------
// nsStyleFont
@ -249,11 +260,6 @@ void nsStyleSpacing::CalcPaddingFor(const nsIFrame* aFrame, nsMargin& aPadding)
}
}
static const nscoord kBorderWidths[3] =
{ NSIntPointsToTwips(1),
NSIntPointsToTwips(3),
NSIntPointsToTwips(5) };
void nsStyleSpacing::CalcBorderFor(const nsIFrame* aFrame, nsMargin& aBorder) const
{
if (mHasCachedBorder) {
@ -685,12 +691,18 @@ public:
nsIPresContext* aPresContext);
virtual ~StyleContextImpl();
void* operator new(size_t sz) {
void* rv = new char[sz];
nsCRT::zero(rv, sz);
void* operator new(size_t size) {
void* rv = ::operator new(size);
if (rv) {
nsCRT::zero(rv, size);
}
return rv;
}
void operator delete(void* ptr, size_t size) {
::operator delete(ptr);
}
NS_DECL_ISUPPORTS
virtual nsIStyleContext* GetParent(void) const;

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

@ -30,6 +30,17 @@
static NS_DEFINE_IID(kIStyleContextIID, NS_ISTYLECONTEXT_IID);
// Default border widths for enumerated values
//
// NOTE: don't use NSIntPointsToTwips here because that results in a
// global constructor been created to do the *runtime* initializing
// because some compilers don't know how to expand inline methods in
// this situation.
static nscoord kBorderWidths[3] = {
nscoord(1 * TWIPS_PER_POINT_INT),
nscoord(3 * TWIPS_PER_POINT_INT),
nscoord(5 * TWIPS_PER_POINT_INT)
};
// --------------------
// nsStyleFont
@ -249,11 +260,6 @@ void nsStyleSpacing::CalcPaddingFor(const nsIFrame* aFrame, nsMargin& aPadding)
}
}
static const nscoord kBorderWidths[3] =
{ NSIntPointsToTwips(1),
NSIntPointsToTwips(3),
NSIntPointsToTwips(5) };
void nsStyleSpacing::CalcBorderFor(const nsIFrame* aFrame, nsMargin& aBorder) const
{
if (mHasCachedBorder) {
@ -685,12 +691,18 @@ public:
nsIPresContext* aPresContext);
virtual ~StyleContextImpl();
void* operator new(size_t sz) {
void* rv = new char[sz];
nsCRT::zero(rv, sz);
void* operator new(size_t size) {
void* rv = ::operator new(size);
if (rv) {
nsCRT::zero(rv, size);
}
return rv;
}
void operator delete(void* ptr, size_t size) {
::operator delete(ptr);
}
NS_DECL_ISUPPORTS
virtual nsIStyleContext* GetParent(void) const;