From c463305e8196f14f7884494c989486c915e9f7dc Mon Sep 17 00:00:00 2001 From: "kipp%netscape.com" Date: Fri, 26 Feb 1999 19:40:22 +0000 Subject: [PATCH] Cleaned up all of the operator new/delete usage --- gfx/src/gtk/nsFontMetricsGTK.h | 6 +----- gfx/src/gtk/nsRenderingContextGTK.h | 6 +----- gfx/src/mac/nsFontMetricsMac.h | 6 +----- gfx/src/mac/nsRenderingContextMac.cpp | 9 ++------- gfx/src/mac/nsRenderingContextMac.h | 6 +----- gfx/src/motif/nsFontMetricsMotif.h | 6 +----- gfx/src/motif/nsRenderingContextMotif.h | 6 +----- gfx/src/nsImageGroup.cpp | 6 +----- gfx/src/nsImageManager.cpp | 6 +----- gfx/src/nsImageRequest.h | 6 +----- gfx/src/nsImageSystemServices.cpp | 6 +----- gfx/src/ps/nsFontMetricsPS.h | 6 +----- gfx/src/ps/nsRenderingContextPS.h | 6 +----- gfx/src/windows/nsFontMetricsWin.h | 6 +----- gfx/src/windows/nsRenderingContextWin.h | 6 +----- 15 files changed, 16 insertions(+), 77 deletions(-) diff --git a/gfx/src/gtk/nsFontMetricsGTK.h b/gfx/src/gtk/nsFontMetricsGTK.h index c9bb74f49eb4..b445db65bc99 100644 --- a/gfx/src/gtk/nsFontMetricsGTK.h +++ b/gfx/src/gtk/nsFontMetricsGTK.h @@ -36,11 +36,7 @@ public: nsFontMetricsGTK(); virtual ~nsFontMetricsGTK(); - void* operator new(size_t sz) { - void* rv = new char[sz]; - nsCRT::zero(rv, sz); - return rv; - } + NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW NS_DECL_ISUPPORTS diff --git a/gfx/src/gtk/nsRenderingContextGTK.h b/gfx/src/gtk/nsRenderingContextGTK.h index 7d8ae5306c44..7861564fec35 100644 --- a/gfx/src/gtk/nsRenderingContextGTK.h +++ b/gfx/src/gtk/nsRenderingContextGTK.h @@ -45,11 +45,7 @@ public: nsRenderingContextGTK(); virtual ~nsRenderingContextGTK(); - void* operator new(size_t sz) { - void* rv = new char[sz]; - nsCRT::zero(rv, sz); - return rv; - } + NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW NS_DECL_ISUPPORTS diff --git a/gfx/src/mac/nsFontMetricsMac.h b/gfx/src/mac/nsFontMetricsMac.h index bf94261effa0..d954e7a0bed9 100644 --- a/gfx/src/mac/nsFontMetricsMac.h +++ b/gfx/src/mac/nsFontMetricsMac.h @@ -34,11 +34,7 @@ public: nsFontMetricsMac(); ~nsFontMetricsMac(); - void* operator new(size_t sz) { - void* rv = new char[sz]; - nsCRT::zero(rv, sz); - return rv; - } + NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW NS_DECL_ISUPPORTS diff --git a/gfx/src/mac/nsRenderingContextMac.cpp b/gfx/src/mac/nsRenderingContextMac.cpp index 1540bc4937a6..b32fe4d4be58 100644 --- a/gfx/src/mac/nsRenderingContextMac.cpp +++ b/gfx/src/mac/nsRenderingContextMac.cpp @@ -81,6 +81,8 @@ public: GraphicState(GraphicState* aGS); ~GraphicState(); + NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW + void Clear(); void Init(nsDrawingSurface aSurface); void Init(GrafPtr aPort); @@ -90,13 +92,6 @@ public: protected: RgnHandle DuplicateRgn(RgnHandle aRgn); -public: - void* operator new(size_t sz) { - void* rv = new char[sz]; - nsCRT::zero(rv, sz); - return rv; - } - public: nsTransform2D * mTMatrix; // transform that all the graphics drawn here will obey diff --git a/gfx/src/mac/nsRenderingContextMac.h b/gfx/src/mac/nsRenderingContextMac.h index b484c44c8194..8dacce2595da 100644 --- a/gfx/src/mac/nsRenderingContextMac.h +++ b/gfx/src/mac/nsRenderingContextMac.h @@ -42,11 +42,7 @@ public: nsRenderingContextMac(); ~nsRenderingContextMac(); - void* operator new(size_t sz) { - void* rv = new char[sz]; - nsCRT::zero(rv, sz); - return rv; - } + NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW NS_DECL_ISUPPORTS diff --git a/gfx/src/motif/nsFontMetricsMotif.h b/gfx/src/motif/nsFontMetricsMotif.h index 4f789b3602d6..603871af2b48 100644 --- a/gfx/src/motif/nsFontMetricsMotif.h +++ b/gfx/src/motif/nsFontMetricsMotif.h @@ -34,11 +34,7 @@ public: nsFontMetricsMotif(); ~nsFontMetricsMotif(); - void* operator new(size_t sz) { - void* rv = new char[sz]; - nsCRT::zero(rv, sz); - return rv; - } + NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW NS_DECL_ISUPPORTS diff --git a/gfx/src/motif/nsRenderingContextMotif.h b/gfx/src/motif/nsRenderingContextMotif.h index 3ad087a3ddcc..51ed312ab0b1 100644 --- a/gfx/src/motif/nsRenderingContextMotif.h +++ b/gfx/src/motif/nsRenderingContextMotif.h @@ -53,11 +53,7 @@ public: nsRenderingContextMotif(); ~nsRenderingContextMotif(); - void* operator new(size_t sz) { - void* rv = new char[sz]; - nsCRT::zero(rv, sz); - return rv; - } + NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW NS_DECL_ISUPPORTS diff --git a/gfx/src/nsImageGroup.cpp b/gfx/src/nsImageGroup.cpp index e4b63b45f103..224281f87201 100644 --- a/gfx/src/nsImageGroup.cpp +++ b/gfx/src/nsImageGroup.cpp @@ -46,11 +46,7 @@ public: nsresult Init(nsIDeviceContext *aDeviceContext, nsIURLGroup* aURLGroup); - void* operator new(size_t sz) { - void* rv = new char[sz]; - nsCRT::zero(rv, sz); - return rv; - } + NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW NS_DECL_ISUPPORTS diff --git a/gfx/src/nsImageManager.cpp b/gfx/src/nsImageManager.cpp index 384647051efe..f6c8a29a3eaf 100644 --- a/gfx/src/nsImageManager.cpp +++ b/gfx/src/nsImageManager.cpp @@ -31,11 +31,7 @@ public: nsresult Init(); - void* operator new(size_t sz) { - void* rv = new char[sz]; - nsCRT::zero(rv, sz); - return rv; - } + NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW NS_DECL_ISUPPORTS diff --git a/gfx/src/nsImageRequest.h b/gfx/src/nsImageRequest.h index cef39ee885ae..3170f758056b 100644 --- a/gfx/src/nsImageRequest.h +++ b/gfx/src/nsImageRequest.h @@ -40,11 +40,7 @@ public: PRUint32 aFlags, ilINetContext* aNetContext); - void* operator new(size_t sz) { - void* rv = new char[sz]; - nsCRT::zero(rv, sz); - return rv; - } + NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW NS_DECL_ISUPPORTS diff --git a/gfx/src/nsImageSystemServices.cpp b/gfx/src/nsImageSystemServices.cpp index d3a689e1abec..c2d458e8fd11 100644 --- a/gfx/src/nsImageSystemServices.cpp +++ b/gfx/src/nsImageSystemServices.cpp @@ -31,11 +31,7 @@ public: ImageSystemServicesImpl(); ~ImageSystemServicesImpl(); - void* operator new(size_t sz) { - void* rv = new char[sz]; - nsCRT::zero(rv, sz); - return rv; - } + NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW NS_DECL_ISUPPORTS diff --git a/gfx/src/ps/nsFontMetricsPS.h b/gfx/src/ps/nsFontMetricsPS.h index fba0987cb9f6..a99f042c1289 100644 --- a/gfx/src/ps/nsFontMetricsPS.h +++ b/gfx/src/ps/nsFontMetricsPS.h @@ -38,11 +38,7 @@ public: nsFontMetricsPS(); virtual ~nsFontMetricsPS(); - void* operator new(size_t sz) { - void* rv = new char[sz]; - nsCRT::zero(rv, sz); - return rv; - } + NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW NS_DECL_ISUPPORTS diff --git a/gfx/src/ps/nsRenderingContextPS.h b/gfx/src/ps/nsRenderingContextPS.h index ae89fb47e783..e1dfe36c9b47 100644 --- a/gfx/src/ps/nsRenderingContextPS.h +++ b/gfx/src/ps/nsRenderingContextPS.h @@ -44,11 +44,7 @@ public: nsRenderingContextPS(); virtual ~nsRenderingContextPS(); - void* operator new(size_t sz) { - void* rv = new char[sz]; - nsCRT::zero(rv, sz); - return rv; - } + NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW NS_DECL_ISUPPORTS diff --git a/gfx/src/windows/nsFontMetricsWin.h b/gfx/src/windows/nsFontMetricsWin.h index 3711cf447d5c..00246f594021 100644 --- a/gfx/src/windows/nsFontMetricsWin.h +++ b/gfx/src/windows/nsFontMetricsWin.h @@ -35,11 +35,7 @@ public: nsFontMetricsWin(); ~nsFontMetricsWin(); - void* operator new(size_t sz) { - void* rv = new char[sz]; - nsCRT::zero(rv, sz); - return rv; - } + NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW NS_DECL_ISUPPORTS diff --git a/gfx/src/windows/nsRenderingContextWin.h b/gfx/src/windows/nsRenderingContextWin.h index 12a576bbb1e2..512031d327f7 100644 --- a/gfx/src/windows/nsRenderingContextWin.h +++ b/gfx/src/windows/nsRenderingContextWin.h @@ -49,11 +49,7 @@ class nsRenderingContextWin : public nsIRenderingContext, public: nsRenderingContextWin(); - void* operator new(size_t sz) { - void* rv = new char[sz]; - nsCRT::zero(rv, sz); - return rv; - } + NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW NS_DECL_ISUPPORTS