From c7764aadc029304a34bffbf57a82d5343dfa082b Mon Sep 17 00:00:00 2001 From: "kipp%netscape.com" Date: Fri, 26 Feb 1999 19:57:18 +0000 Subject: [PATCH] use macro to get operator new correct --- htmlparser/robot/nsRobotSink.cpp | 6 +----- parser/htmlparser/robot/nsRobotSink.cpp | 6 +----- view/src/nsView.h | 7 +------ view/src/nsViewManager.h | 6 +----- 4 files changed, 4 insertions(+), 21 deletions(-) diff --git a/htmlparser/robot/nsRobotSink.cpp b/htmlparser/robot/nsRobotSink.cpp index f9074a2afd41..1fb2c0292d05 100644 --- a/htmlparser/robot/nsRobotSink.cpp +++ b/htmlparser/robot/nsRobotSink.cpp @@ -42,11 +42,7 @@ public: RobotSink(); ~RobotSink(); - void* operator new(size_t size) { - void* rv = ::operator new(size); - nsCRT::zero(rv, size); - return (void*) rv; - } + NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW // nsISupports NS_DECL_ISUPPORTS diff --git a/parser/htmlparser/robot/nsRobotSink.cpp b/parser/htmlparser/robot/nsRobotSink.cpp index f9074a2afd41..1fb2c0292d05 100644 --- a/parser/htmlparser/robot/nsRobotSink.cpp +++ b/parser/htmlparser/robot/nsRobotSink.cpp @@ -42,11 +42,7 @@ public: RobotSink(); ~RobotSink(); - void* operator new(size_t size) { - void* rv = ::operator new(size); - nsCRT::zero(rv, size); - return (void*) rv; - } + NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW // nsISupports NS_DECL_ISUPPORTS diff --git a/view/src/nsView.h b/view/src/nsView.h index 1fed6ac41e0a..cb83285ad558 100644 --- a/view/src/nsView.h +++ b/view/src/nsView.h @@ -36,12 +36,7 @@ class nsView : public nsIView public: nsView(); - // Overloaded new operator. Initializes the memory to 0 - void* operator new(size_t sz) { - void* rv = new char[sz]; - nsCRT::zero(rv, sz); - return rv; - } + NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW // nsISupports NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); diff --git a/view/src/nsViewManager.h b/view/src/nsViewManager.h index c0b00cb11b4f..1962094857a5 100644 --- a/view/src/nsViewManager.h +++ b/view/src/nsViewManager.h @@ -35,11 +35,7 @@ class nsViewManager : public nsIViewManager public: nsViewManager(); - 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