--- a/accessible/src/base/nsAccessNode.cpp
+++ b/accessible/src/base/nsAccessNode.cpp
@@ -126,17 +126,17 @@ nsAccessNode::~nsAccessNode()
void nsAccessNode::LastRelease()
{
// First cleanup if needed...
if (mWeakShell) {
Shutdown();
NS_ASSERTION(!mWeakShell, "A Shutdown() impl forgot to call its parent's Shutdown?");
}
// ... then die.
- NS_DELETEXPCOM(this);
+ delete this;
}
////////////////////////////////////////////////////////////////////////////////
// nsAccessNode public
PRBool
nsAccessNode::Init()
{
--- a/caps/src/nsNullPrincipal.cpp
+++ b/caps/src/nsNullPrincipal.cpp
@@ -71,17 +71,17 @@ nsNullPrincipal::AddRef()
NS_IMETHODIMP_(nsrefcnt)
nsNullPrincipal::Release()
{
NS_PRECONDITION(0 != mJSPrincipals.refcount, "dup release");
nsrefcnt count = PR_AtomicDecrement((PRInt32 *)&mJSPrincipals.refcount);
NS_LOG_RELEASE(this, count, "nsNullPrincipal");
if (count == 0) {
- NS_DELETEXPCOM(this);
+ delete this;
}
return count;
}
nsNullPrincipal::nsNullPrincipal()
{
}
--- a/caps/src/nsPrincipal.cpp
+++ b/caps/src/nsPrincipal.cpp
@@ -159,17 +159,17 @@ nsPrincipal::AddRef()
NS_IMETHODIMP_(nsrefcnt)
nsPrincipal::Release()
{
NS_PRECONDITION(0 != mJSPrincipals.refcount, "dup release");
nsrefcnt count = PR_AtomicDecrement((PRInt32 *)&mJSPrincipals.refcount);
NS_LOG_RELEASE(this, count, "nsPrincipal");
if (count == 0) {
- NS_DELETEXPCOM(this);
+ delete this;
}
return count;
}
nsPrincipal::nsPrincipal()
: mCapabilities(nsnull),
mSecurityPolicy(nsnull),
--- a/caps/src/nsSystemPrincipal.cpp
+++ b/caps/src/nsSystemPrincipal.cpp
@@ -68,17 +68,17 @@ nsSystemPrincipal::AddRef()
NS_IMETHODIMP_(nsrefcnt)
nsSystemPrincipal::Release()
{
NS_PRECONDITION(0 != mJSPrincipals.refcount, "dup release");
nsrefcnt count = PR_AtomicDecrement((PRInt32 *)&mJSPrincipals.refcount);
NS_LOG_RELEASE(this, count, "nsSystemPrincipal");
if (count == 0) {
- NS_DELETEXPCOM(this);
+ delete this;
}
return count;
}
///////////////////////////////////////
// Methods implementing nsIPrincipal //
--- a/content/base/src/nsXMLHttpRequest.cpp
+++ b/content/base/src/nsXMLHttpRequest.cpp
@@ -1355,18 +1355,17 @@ nsXMLHttpRequest::GetAllResponseHeaders(
if (mState & XML_HTTP_REQUEST_USE_XSITE_AC) {
return NS_OK;
}
nsCOMPtr<nsIHttpChannel> httpChannel = GetCurrentHttpChannel();
if (httpChannel) {
- nsHeaderVisitor *visitor = nsnull;
- NS_NEWXPCOM(visitor, nsHeaderVisitor);
+ nsHeaderVisitor *visitor = new nsHeaderVisitor();
if (!visitor)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(visitor);
nsresult rv = httpChannel->VisitResponseHeaders(visitor);
if (NS_SUCCEEDED(rv))
*_retval = ToNewCString(visitor->Headers());
--- a/content/xbl/src/nsXBLContentSink.cpp
+++ b/content/xbl/src/nsXBLContentSink.cpp
@@ -66,18 +66,17 @@ using namespace mozilla::dom;
nsresult
NS_NewXBLContentSink(nsIXMLContentSink** aResult,
nsIDocument* aDoc,
nsIURI* aURI,
nsISupports* aContainer)
{
NS_ENSURE_ARG_POINTER(aResult);
- nsXBLContentSink* it;
- NS_NEWXPCOM(it, nsXBLContentSink);
+ nsXBLContentSink* it = new nsXBLContentSink();
NS_ENSURE_TRUE(it, NS_ERROR_OUT_OF_MEMORY);
nsCOMPtr<nsIXMLContentSink> kungFuDeathGrip = it;
nsresult rv = it->Init(aDoc, aURI, aContainer);
NS_ENSURE_SUCCESS(rv, rv);
return CallQueryInterface(it, aResult);
}
--- a/content/xml/document/src/nsXMLContentSink.cpp
+++ b/content/xml/document/src/nsXMLContentSink.cpp
@@ -119,18 +119,17 @@ NS_NewXMLContentSink(nsIXMLContentSink**
nsIURI* aURI,
nsISupports* aContainer,
nsIChannel* aChannel)
{
NS_PRECONDITION(nsnull != aResult, "null ptr");
if (nsnull == aResult) {
return NS_ERROR_NULL_POINTER;
}
- nsXMLContentSink* it;
- NS_NEWXPCOM(it, nsXMLContentSink);
+ nsXMLContentSink* it = new nsXMLContentSink();
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsIXMLContentSink> kungFuDeathGrip = it;
nsresult rv = it->Init(aDoc, aURI, aContainer, aChannel);
NS_ENSURE_SUCCESS(rv, rv);
--- a/dom/base/nsGlobalWindowCommands.cpp
+++ b/dom/base/nsGlobalWindowCommands.cpp
@@ -904,27 +904,25 @@ nsClipboardDragDropHookCommand::GetComma
/*---------------------------------------------------------------------------
RegisterWindowCommands
----------------------------------------------------------------------------*/
#define NS_REGISTER_ONE_COMMAND(_cmdClass, _cmdName) \
{ \
- _cmdClass* theCmd; \
- NS_NEWXPCOM(theCmd, _cmdClass); \
+ _cmdClass* theCmd = new _cmdClass(); \
if (!theCmd) return NS_ERROR_OUT_OF_MEMORY; \
rv = inCommandTable->RegisterCommand(_cmdName, \
static_cast<nsIControllerCommand *>(theCmd)); \
}
#define NS_REGISTER_FIRST_COMMAND(_cmdClass, _cmdName) \
{ \
- _cmdClass* theCmd; \
- NS_NEWXPCOM(theCmd, _cmdClass); \
+ _cmdClass* theCmd = new _cmdClass(); \
if (!theCmd) return NS_ERROR_OUT_OF_MEMORY; \
rv = inCommandTable->RegisterCommand(_cmdName, \
static_cast<nsIControllerCommand *>(theCmd));
#define NS_REGISTER_NEXT_COMMAND(_cmdClass, _cmdName) \
rv = inCommandTable->RegisterCommand(_cmdName, \
static_cast<nsIControllerCommand *>(theCmd));
--- a/editor/composer/src/nsComposerController.cpp
+++ b/editor/composer/src/nsComposerController.cpp
@@ -39,27 +39,25 @@
* ***** END LICENSE BLOCK ***** */
#include "nsIControllerCommandTable.h"
#include "nsComposerController.h"
#include "nsComposerCommands.h"
#define NS_REGISTER_ONE_COMMAND(_cmdClass, _cmdName) \
{ \
- _cmdClass* theCmd; \
- NS_NEWXPCOM(theCmd, _cmdClass); \
+ _cmdClass* theCmd = new _cmdClass(); \
NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY); \
rv = inCommandTable->RegisterCommand(_cmdName, \
static_cast<nsIControllerCommand *>(theCmd)); \
}
#define NS_REGISTER_FIRST_COMMAND(_cmdClass, _cmdName) \
{ \
- _cmdClass* theCmd; \
- NS_NEWXPCOM(theCmd, _cmdClass); \
+ _cmdClass* theCmd = new _cmdClass(); \
NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY); \
rv = inCommandTable->RegisterCommand(_cmdName, \
static_cast<nsIControllerCommand *>(theCmd));
#define NS_REGISTER_NEXT_COMMAND(_cmdClass, _cmdName) \
rv = inCommandTable->RegisterCommand(_cmdName, \
static_cast<nsIControllerCommand *>(theCmd));
--- a/editor/composer/src/nsComposerRegistration.cpp
+++ b/editor/composer/src/nsComposerRegistration.cpp
@@ -79,18 +79,17 @@ static NS_METHOD
nsComposeTxtSrvFilterConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult, PRBool aIsForMail)
{
*aResult = NULL;
if (NULL != aOuter)
{
return NS_ERROR_NO_AGGREGATION;
}
- nsComposeTxtSrvFilter * inst;
- NS_NEWXPCOM(inst, nsComposeTxtSrvFilter);
+ nsComposeTxtSrvFilter * inst = new nsComposeTxtSrvFilter();
if (NULL == inst)
{
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(inst);
inst->Init(aIsForMail);
nsresult rv = inst->QueryInterface(aIID, aResult);
NS_RELEASE(inst);
--- a/editor/libeditor/base/nsEditorController.cpp
+++ b/editor/libeditor/base/nsEditorController.cpp
@@ -42,27 +42,25 @@
#include "nsEditorController.h"
#include "nsEditorCommands.h"
#include "nsIControllerCommandTable.h"
#define NS_REGISTER_ONE_COMMAND(_cmdClass, _cmdName) \
{ \
- _cmdClass* theCmd; \
- NS_NEWXPCOM(theCmd, _cmdClass); \
+ _cmdClass* theCmd = new _cmdClass(); \
NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY); \
rv = inCommandTable->RegisterCommand(_cmdName, \
static_cast<nsIControllerCommand *>(theCmd)); \
}
#define NS_REGISTER_FIRST_COMMAND(_cmdClass, _cmdName) \
{ \
- _cmdClass* theCmd; \
- NS_NEWXPCOM(theCmd, _cmdClass); \
+ _cmdClass* theCmd = new _cmdClass(); \
NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY); \
rv = inCommandTable->RegisterCommand(_cmdName, \
static_cast<nsIControllerCommand *>(theCmd));
#define NS_REGISTER_NEXT_COMMAND(_cmdClass, _cmdName) \
rv = inCommandTable->RegisterCommand(_cmdName, \
static_cast<nsIControllerCommand *>(theCmd));
--- a/editor/libeditor/html/nsEditorTxnLog.cpp
+++ b/editor/libeditor/html/nsEditorTxnLog.cpp
@@ -65,17 +65,17 @@ nsrefcnt nsEditorTxnLog::AddRef(void)
{
return ++mRefCnt;
}
nsrefcnt nsEditorTxnLog::Release(void)
{
NS_PRECONDITION(0 != mRefCnt, "dup release");
if (--mRefCnt == 0) {
- NS_DELETEXPCOM(this);
+ delete this;
return 0;
}
return mRefCnt;
}
#else
NS_IMPL_ADDREF(nsEditorTxnLog)
--- a/embedding/browser/webBrowser/nsWebBrowser.cpp
+++ b/embedding/browser/webBrowser/nsWebBrowser.cpp
@@ -148,17 +148,17 @@ NS_IMETHODIMP nsWebBrowser::InternalDest
{
delete mInitInfo;
mInitInfo = nsnull;
}
if (mListenerArray) {
for (PRUint32 i = 0, end = mListenerArray->Length(); i < end; i++) {
nsWebBrowserListenerState *state = mListenerArray->ElementAt(i);
- NS_DELETEXPCOM(state);
+ delete state;
}
delete mListenerArray;
mListenerArray = nsnull;
}
return NS_OK;
}
@@ -231,25 +231,24 @@ NS_IMETHODIMP nsWebBrowser::GetInterface
NS_IMETHODIMP nsWebBrowser::AddWebBrowserListener(nsIWeakReference *aListener, const nsIID& aIID)
{
NS_ENSURE_ARG_POINTER(aListener);
nsresult rv = NS_OK;
if (!mWebProgress) {
// The window hasn't been created yet, so queue up the listener. They'll be
// registered when the window gets created.
- nsAutoPtr<nsWebBrowserListenerState> state;
- NS_NEWXPCOM(state, nsWebBrowserListenerState);
+ nsAutoPtr<nsWebBrowserListenerState> state = new nsWebBrowserListenerState();
if (!state) return NS_ERROR_OUT_OF_MEMORY;
state->mWeakPtr = aListener;
state->mID = aIID;
if (!mListenerArray) {
- NS_NEWXPCOM(mListenerArray, nsTArray<nsWebBrowserListenerState*>);
+ mListenerArray = new nsTArray<nsWebBrowserListenerState*>();
if (!mListenerArray) {
return NS_ERROR_OUT_OF_MEMORY;
}
}
if (!mListenerArray->AppendElement(state)) {
return NS_ERROR_OUT_OF_MEMORY;
}
@@ -310,19 +309,19 @@ NS_IMETHODIMP nsWebBrowser::RemoveWebBro
}
count--;
}
// if we've emptied the array, get rid of it.
if (0 >= mListenerArray->Length()) {
for (PRUint32 i = 0, end = mListenerArray->Length(); i < end; i++) {
nsWebBrowserListenerState *state = mListenerArray->ElementAt(i);
- NS_DELETEXPCOM(state);
+ delete state;
}
- NS_DELETEXPCOM(mListenerArray);
+ delete mListenerArray;
mListenerArray = nsnull;
}
} else {
nsCOMPtr<nsISupports> supports(do_QueryReferent(aListener));
if (!supports) return NS_ERROR_INVALID_ARG;
rv = UnBindListener(supports, aIID);
}
@@ -1167,19 +1166,19 @@ NS_IMETHODIMP nsWebBrowser::Create()
NS_ASSERTION(state, "array construction problem");
nsCOMPtr<nsISupports> listener = do_QueryReferent(state->mWeakPtr);
NS_ASSERTION(listener, "bad listener");
(void)BindListener(listener, state->mID);
i++;
}
for (PRUint32 i = 0, end = mListenerArray->Length(); i < end; i++) {
nsWebBrowserListenerState *state = mListenerArray->ElementAt(i);
- NS_DELETEXPCOM(state);
+ delete state;
}
- NS_DELETEXPCOM(mListenerArray);
+ delete mListenerArray;
mListenerArray = nsnull;
}
// HACK ALERT - this registration registers the nsDocShellTreeOwner as a
// nsIWebBrowserListener so it can setup its MouseListener in one of the
// progress callbacks. If we can register the MouseListener another way, this
// registration can go away, and nsDocShellTreeOwner can stop implementing
// nsIWebProgressListener.
--- a/embedding/components/printingui/src/win/nsPrintProgress.cpp
+++ b/embedding/components/printingui/src/win/nsPrintProgress.cpp
@@ -64,17 +64,17 @@ NS_IMETHODIMP_(nsrefcnt) nsPrintProgress
nsrefcnt count;
NS_PRECONDITION(0 != mRefCnt, "dup release");
count = PR_AtomicDecrement((PRInt32 *)&mRefCnt);
//NS_LOG_RELEASE(this, count, "nsPrintProgress");
if (0 == count) {
mRefCnt = 1; /* stabilize */
/* enable this to find non-threadsafe destructors: */
/* NS_ASSERT_OWNINGTHREAD(nsPrintProgress); */
- NS_DELETEXPCOM(this);
+ delete this;
return 0;
}
return count;
}
#endif
NS_INTERFACE_MAP_BEGIN(nsPrintProgress)
--- a/extensions/spellcheck/src/mozSpellCheckerFactory.cpp
+++ b/extensions/spellcheck/src/mozSpellCheckerFactory.cpp
@@ -87,25 +87,23 @@ static NS_IMETHODIMP
mozInlineSpellCheckerConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult)
{
if (! mozInlineSpellChecker::CanEnableInlineSpellChecking())
return NS_ERROR_FAILURE;
nsresult rv;
- mozInlineSpellChecker* inst;
-
*aResult = NULL;
if (NULL != aOuter) {
rv = NS_ERROR_NO_AGGREGATION;
return rv;
}
- NS_NEWXPCOM(inst, mozInlineSpellChecker);
+ mozInlineSpellChecker* inst = new mozInlineSpellChecker();
if (NULL == inst) {
rv = NS_ERROR_OUT_OF_MEMORY;
return rv;
}
NS_ADDREF(inst);
rv = inst->QueryInterface(aIID, aResult);
NS_RELEASE(inst);
--- a/gfx/src/thebes/nsThebesGfxFactory.cpp
+++ b/gfx/src/thebes/nsThebesGfxFactory.cpp
@@ -69,18 +69,17 @@ static NS_IMETHODIMP nsScriptableRegionC
}
*aResult = nsnull;
if (aOuter)
{
rv = NS_ERROR_NO_AGGREGATION;
return rv;
}
- nsCOMPtr <nsIRegion> rgn;
- NS_NEWXPCOM(rgn, nsThebesRegion);
+ nsCOMPtr <nsIRegion> rgn = new nsThebesRegion();
nsCOMPtr<nsIScriptableRegion> scriptableRgn;
if (rgn != nsnull)
{
scriptableRgn = new nsScriptableRegion(rgn);
inst = scriptableRgn;
}
if (!inst)
{
--- a/gfx/thebes/gfxTypes.h
+++ b/gfx/thebes/gfxTypes.h
@@ -99,17 +99,17 @@ public:
return count; \
} \
nsrefcnt Release(void) { \
NS_PRECONDITION(0 != mRefCnt, "dup release"); \
nsrefcnt count = PR_AtomicDecrement((PRInt32 *)&mRefCnt); \
NS_LOG_RELEASE(this, count, #_class); \
if (count == 0) { \
mRefCnt = 1; /* stabilize */ \
- NS_DELETEXPCOM(this); \
+ delete this; \
return 0; \
} \
return count; \
} \
protected: \
nsAutoRefCnt mRefCnt; \
public:
--- a/intl/unicharutil/src/nsCaseConversionImp2.cpp
+++ b/intl/unicharutil/src/nsCaseConversionImp2.cpp
@@ -159,17 +159,17 @@ static nsCompressedMap gUpperMap = {
static nsCompressedMap gLowerMap = {
reinterpret_cast<const PRUnichar*>(&gToLower[0]),
gToLowerItems
};
nsCaseConversionImp2* nsCaseConversionImp2::GetInstance()
{
if (!gCaseConv)
- NS_NEWXPCOM(gCaseConv, nsCaseConversionImp2);
+ gCaseConv = new nsCaseConversionImp2();
return gCaseConv;
}
NS_IMETHODIMP_(nsrefcnt) nsCaseConversionImp2::AddRef(void)
{
return (nsrefcnt)1;
}
--- a/js/src/xpconnect/src/xpcwrappedjs.cpp
+++ b/js/src/xpconnect/src/xpcwrappedjs.cpp
@@ -232,17 +232,17 @@ nsXPCWrappedJS::Release(void)
do_decrement:
nsrefcnt cnt = (nsrefcnt) PR_AtomicDecrement((PRInt32*)&mRefCnt);
NS_LOG_RELEASE(this, cnt, "nsXPCWrappedJS");
if(0 == cnt)
{
- NS_DELETEXPCOM(this); // also unlinks us from chain
+ delete this; // also unlinks us from chain
return 0;
}
if(1 == cnt)
{
if(IsValid())
RemoveFromRootSet(rt->GetJSRuntime());
// If we are not the root wrapper or if we are not being used from a
--- a/js/src/xpconnect/tests/components/xpctest_noisy.cpp
+++ b/js/src/xpconnect/tests/components/xpctest_noisy.cpp
@@ -72,17 +72,17 @@ NS_IMETHODIMP_(nsrefcnt) xpctestNoisy::A
NS_IMETHODIMP_(nsrefcnt) xpctestNoisy::Release(void)
{
NS_PRECONDITION(0 != mRefCnt, "dup release");
--mRefCnt;
printf("Noisy %d - decremented refcount to %d\n", mID, mRefCnt.get());
NS_LOG_RELEASE(this, mRefCnt, "xpctestNoisy");
if (mRefCnt == 0) {
- NS_DELETEXPCOM(this);
+ delete this;
return 0;
}
return mRefCnt;
}
NS_IMETHODIMP
xpctestNoisy::QueryInterface(REFNSIID iid, void** result)
{
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -784,18 +784,17 @@ DocumentViewerImpl::InitPresentationStuf
// Save old listener so we can unregister it
nsCOMPtr<nsIDOMFocusListener> oldFocusListener = mFocusListener;
// focus listener
//
// now register ourselves as a focus listener, so that we get called
// when the focus changes in the window
- nsDocViewerFocusListener *focusListener;
- NS_NEWXPCOM(focusListener, nsDocViewerFocusListener);
+ nsDocViewerFocusListener *focusListener = new nsDocViewerFocusListener();
NS_ENSURE_TRUE(focusListener, NS_ERROR_OUT_OF_MEMORY);
focusListener->Init(this);
// mFocusListener is a strong reference
mFocusListener = focusListener;
if (mDocument) {
--- a/layout/build/nsLayoutModule.cpp
+++ b/layout/build/nsLayoutModule.cpp
@@ -578,25 +578,23 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsJSURI)
// NS_GENERIC_FACTORY_CONSTRUCTOR without the NS_ADDREF/NS_RELEASE
#define NS_GENERIC_FACTORY_CONSTRUCTOR_NOREFS(_InstanceClass) \
static NS_IMETHODIMP \
_InstanceClass##Constructor(nsISupports *aOuter, REFNSIID aIID, \
void **aResult) \
{ \
nsresult rv; \
\
- _InstanceClass * inst; \
- \
*aResult = NULL; \
if (NULL != aOuter) { \
rv = NS_ERROR_NO_AGGREGATION; \
return rv; \
} \
\
- NS_NEWXPCOM(inst, _InstanceClass); \
+ _InstanceClass * inst = new _InstanceClass(); \
if (NULL == inst) { \
rv = NS_ERROR_OUT_OF_MEMORY; \
return rv; \
} \
rv = inst->QueryInterface(aIID, aResult); \
\
return rv; \
} \
--- a/layout/generic/nsBulletFrame.cpp
+++ b/layout/generic/nsBulletFrame.cpp
@@ -137,18 +137,17 @@ nsBulletFrame::DidSetStyleContext(nsStyl
{
nsFrame::DidSetStyleContext(aOldStyleContext);
imgIRequest *newRequest = GetStyleList()->GetListStyleImage();
if (newRequest) {
if (!mListener) {
- nsBulletListener *listener;
- NS_NEWXPCOM(listener, nsBulletListener);
+ nsBulletListener *listener = new nsBulletListener();
NS_ADDREF(listener);
listener->SetFrame(this);
listener->QueryInterface(NS_GET_IID(imgIDecoderObserver), getter_AddRefs(mListener));
NS_ASSERTION(mListener, "queryinterface for the listener failed");
NS_RELEASE(listener);
}
PRBool needNewRequest = PR_TRUE;
--- a/layout/xul/base/src/nsImageBoxFrame.cpp
+++ b/layout/xul/base/src/nsImageBoxFrame.cpp
@@ -217,18 +217,17 @@ nsImageBoxFrame::DestroyFrom(nsIFrame* a
NS_IMETHODIMP
nsImageBoxFrame::Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow)
{
if (!mListener) {
- nsImageBoxListener *listener;
- NS_NEWXPCOM(listener, nsImageBoxListener);
+ nsImageBoxListener *listener = new nsImageBoxListener();
NS_ADDREF(listener);
listener->SetFrame(this);
listener->QueryInterface(NS_GET_IID(imgIDecoderObserver), getter_AddRefs(mListener));
NS_RELEASE(listener);
}
mSuppressStyleCheck = PR_TRUE;
nsresult rv = nsLeafBoxFrame::Init(aContent, aParent, aPrevInFlow);
--- a/modules/libjar/nsJAR.cpp
+++ b/modules/libjar/nsJAR.cpp
@@ -140,17 +140,17 @@ nsrefcnt nsJAR::Release(void)
nsrefcnt count;
NS_PRECONDITION(0 != mRefCnt, "dup release");
count = PR_AtomicDecrement((PRInt32 *)&mRefCnt);
NS_LOG_RELEASE(this, count, "nsJAR");
if (0 == count) {
mRefCnt = 1; /* stabilize */
/* enable this to find non-threadsafe destructors: */
/* NS_ASSERT_OWNINGTHREAD(nsJAR); */
- NS_DELETEXPCOM(this);
+ delete this;
return 0;
}
else if (1 == count && mCache) {
nsresult rv = mCache->ReleaseZip(this);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to release zip file");
}
return count;
}
--- a/modules/libpr0n/decoders/icon/nsIconProtocolHandler.cpp
+++ b/modules/libpr0n/decoders/icon/nsIconProtocolHandler.cpp
@@ -89,18 +89,17 @@ NS_IMETHODIMP nsIconProtocolHandler::Get
}
NS_IMETHODIMP nsIconProtocolHandler::NewURI(const nsACString &aSpec,
const char *aOriginCharset, // ignored
nsIURI *aBaseURI,
nsIURI **result)
{
- nsCOMPtr<nsIURI> uri;
- NS_NEWXPCOM(uri, nsMozIconURI);
+ nsCOMPtr<nsIURI> uri = new nsMozIconURI();
if (!uri) return NS_ERROR_OUT_OF_MEMORY;
nsresult rv = uri->SetSpec(aSpec);
if (NS_FAILED(rv)) return rv;
NS_ADDREF(*result = uri);
return NS_OK;
}
--- a/modules/libpr0n/src/imgLoader.cpp
+++ b/modules/libpr0n/src/imgLoader.cpp
@@ -656,17 +656,17 @@ nsresult imgLoader::CreateNewProxyForReq
calling thread here and pass it off to |proxyRequest| so that it call
proxy calls to |aObserver|.
*/
imgRequestProxy *proxyRequest;
if (aProxyRequest) {
proxyRequest = static_cast<imgRequestProxy *>(aProxyRequest);
} else {
- NS_NEWXPCOM(proxyRequest, imgRequestProxy);
+ proxyRequest = new imgRequestProxy();
if (!proxyRequest) return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(proxyRequest);
/* It is important to call |SetLoadFlags()| before calling |Init()| because
|Init()| adds the request to the loadgroup.
*/
proxyRequest->SetLoadFlags(aLoadFlags);
--- a/modules/libpr0n/src/imgTools.cpp
+++ b/modules/libpr0n/src/imgTools.cpp
@@ -75,17 +75,17 @@ NS_IMETHODIMP imgTools::DecodeImageData(
const nsACString& aMimeType,
imgIContainer **aContainer)
{
nsresult rv;
NS_ENSURE_ARG_POINTER(aInStr);
// If the caller didn't provide a container, create one
if (!*aContainer) {
- NS_NEWXPCOM(*aContainer, imgContainer);
+ *aContainer = new imgContainer();
if (!*aContainer)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*aContainer);
}
// Initialize the container. If we're using the one from the caller, we
// require that it not be initialized
nsCString mimeType(aMimeType);
--- a/netwerk/base/src/nsMIMEInputStream.cpp
+++ b/netwerk/base/src/nsMIMEInputStream.cpp
@@ -283,18 +283,17 @@ NS_IMETHODIMP nsMIMEInputStream::SetEOF(
NS_METHOD
nsMIMEInputStreamConstructor(nsISupports *outer, REFNSIID iid, void **result)
{
*result = nsnull;
if (outer)
return NS_ERROR_NO_AGGREGATION;
- nsMIMEInputStream *inst;
- NS_NEWXPCOM(inst, nsMIMEInputStream);
+ nsMIMEInputStream *inst = new nsMIMEInputStream();
if (!inst)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(inst);
nsresult rv = inst->Init();
if (NS_FAILED(rv)) {
NS_RELEASE(inst);
--- a/netwerk/base/src/nsStandardURL.cpp
+++ b/netwerk/base/src/nsStandardURL.cpp
@@ -1646,18 +1646,17 @@ nsStandardURL::SchemeIs(const char *sche
*result = SegmentIs(mScheme, scheme);
return NS_OK;
}
/* virtual */ nsStandardURL*
nsStandardURL::StartClone()
{
- nsStandardURL *clone;
- NS_NEWXPCOM(clone, nsStandardURL);
+ nsStandardURL *clone = new nsStandardURL();
return clone;
}
NS_IMETHODIMP
nsStandardURL::Clone(nsIURI **result)
{
nsStandardURL *clone = StartClone();
if (!clone)
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -1535,33 +1535,31 @@ nsHttpHandler::AllowPort(PRInt32 port, c
// nsHttpHandler::nsIProxiedProtocolHandler
//-----------------------------------------------------------------------------
NS_IMETHODIMP
nsHttpHandler::NewProxiedChannel(nsIURI *uri,
nsIProxyInfo* givenProxyInfo,
nsIChannel **result)
{
- nsHttpChannel *httpChannel = nsnull;
-
LOG(("nsHttpHandler::NewProxiedChannel [proxyInfo=%p]\n",
givenProxyInfo));
nsCOMPtr<nsProxyInfo> proxyInfo;
if (givenProxyInfo) {
proxyInfo = do_QueryInterface(givenProxyInfo);
NS_ENSURE_ARG(proxyInfo);
}
PRBool https;
nsresult rv = uri->SchemeIs("https", &https);
if (NS_FAILED(rv))
return rv;
- NS_NEWXPCOM(httpChannel, nsHttpChannel);
+ nsHttpChannel *httpChannel = new nsHttpChannel();
if (!httpChannel)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(httpChannel);
// select proxy caps if using a non-transparent proxy. SSL tunneling
// should not use proxy settings.
PRInt8 caps;
if (proxyInfo && !nsCRT::strcmp(proxyInfo->Type(), "http") && !https)
--- a/netwerk/protocol/res/nsResProtocolHandler.cpp
+++ b/netwerk/protocol/res/nsResProtocolHandler.cpp
@@ -124,18 +124,17 @@ nsResURL::EnsureFile()
#endif
return rv;
}
/* virtual */ nsStandardURL*
nsResURL::StartClone()
{
- nsResURL *clone;
- NS_NEWXPCOM(clone, nsResURL);
+ nsResURL *clone = new nsResURL();
return clone;
}
NS_IMETHODIMP
nsResURL::GetClassIDNoAlloc(nsCID *aClassIDNoAlloc)
{
*aClassIDNoAlloc = kResURLCID;
return NS_OK;
@@ -299,18 +298,17 @@ nsResProtocolHandler::GetProtocolFlags(P
NS_IMETHODIMP
nsResProtocolHandler::NewURI(const nsACString &aSpec,
const char *aCharset,
nsIURI *aBaseURI,
nsIURI **result)
{
nsresult rv;
- nsResURL *resURL;
- NS_NEWXPCOM(resURL, nsResURL);
+ nsResURL *resURL = new nsResURL();
if (!resURL)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(resURL);
// unescape any %2f and %2e to make sure nsStandardURL coalesces them.
// Later net_GetFileFromURLSpec() will do a full unescape and we want to
// treat them the same way the file system will. (bugs 380994, 394075)
nsCAutoString spec;
--- a/security/manager/ssl/src/nsNSSModule.cpp
+++ b/security/manager/ssl/src/nsNSSModule.cpp
@@ -102,17 +102,17 @@ static NS_IMETHODIMP
return NS_ERROR_FAILURE; \
} \
else \
{ \
if (!EnsureNSSInitialized(nssEnsure)) \
return NS_ERROR_FAILURE; \
} \
\
- NS_NEWXPCOM(inst, _InstanceClass); \
+ inst = new _InstanceClass(); \
if (NULL == inst) { \
if (triggeredByNSSComponent) \
EnsureNSSInitialized(nssInitFailed); \
rv = NS_ERROR_OUT_OF_MEMORY; \
return rv; \
} \
NS_ADDREF(inst); \
rv = inst->QueryInterface(aIID, aResult); \
@@ -151,17 +151,17 @@ static NS_IMETHODIMP
return NS_ERROR_FAILURE; \
} \
else \
{ \
if (!EnsureNSSInitialized(nssEnsure)) \
return NS_ERROR_FAILURE; \
} \
\
- NS_NEWXPCOM(inst, _InstanceClass); \
+ inst = new _InstanceClass(); \
if (NULL == inst) { \
if (triggeredByNSSComponent) \
EnsureNSSInitialized(nssInitFailed); \
rv = NS_ERROR_OUT_OF_MEMORY; \
return rv; \
} \
NS_ADDREF(inst); \
rv = inst->_InitMethod(); \
--- a/uriloader/exthandler/nsExternalProtocolHandler.cpp
+++ b/uriloader/exthandler/nsExternalProtocolHandler.cpp
@@ -396,18 +396,17 @@ NS_IMETHODIMP nsExternalProtocolHandler:
{
// Only try to return a channel if we have a protocol handler for the url.
// nsOSHelperAppService::LoadUriInternal relies on this to check trustedness
// for some platforms at least. (win uses ::ShellExecute and unix uses
// gnome_url_show.)
PRBool haveExternalHandler = HaveExternalProtocolHandler(aURI);
if (haveExternalHandler)
{
- nsCOMPtr<nsIChannel> channel;
- NS_NEWXPCOM(channel, nsExtProtocolChannel);
+ nsCOMPtr<nsIChannel> channel = new nsExtProtocolChannel();
if (!channel) return NS_ERROR_OUT_OF_MEMORY;
((nsExtProtocolChannel*) channel.get())->SetURI(aURI);
channel->SetOriginalURI(aURI);
if (_retval)
{
*_retval = channel;
--- a/widget/src/gtk2/nsGtkIMModule.h
+++ b/widget/src/gtk2/nsGtkIMModule.h
@@ -68,17 +68,17 @@ public:
}
nsrefcnt Release()
{
NS_PRECONDITION(mRefCnt != 0, "mRefCnt is alrady zero");
--mRefCnt;
NS_LOG_RELEASE(this, mRefCnt, "nsGtkIMModule");
if (mRefCnt == 0) {
mRefCnt = 1; /* stabilize */
- NS_DELETEXPCOM(this);
+ delete this;
return 0;
}
return mRefCnt;
}
protected:
nsAutoRefCnt mRefCnt;
--- a/widget/src/gtk2/nsWidgetFactory.cpp
+++ b/widget/src/gtk2/nsWidgetFactory.cpp
@@ -118,17 +118,17 @@ nsNativeThemeGTKConstructor(nsISupports
return NS_ERROR_NO_INTERFACE;
*aResult = NULL;
if (NULL != aOuter) {
rv = NS_ERROR_NO_AGGREGATION;
return rv;
}
- NS_NEWXPCOM(inst, nsNativeThemeGTK);
+ inst = new nsNativeThemeGTK();
if (NULL == inst) {
rv = NS_ERROR_OUT_OF_MEMORY;
return rv;
}
NS_ADDREF(inst);
rv = inst->QueryInterface(aIID, aResult);
NS_RELEASE(inst);
@@ -192,17 +192,17 @@ nsNativeKeyBindingsConstructor(nsISuppor
nsNativeKeyBindings *inst;
*aResult = NULL;
if (NULL != aOuter) {
rv = NS_ERROR_NO_AGGREGATION;
return rv;
}
- NS_NEWXPCOM(inst, nsNativeKeyBindings);
+ inst = new nsNativeKeyBindings();
if (NULL == inst) {
rv = NS_ERROR_OUT_OF_MEMORY;
return rv;
}
NS_ADDREF(inst);
inst->Init(aKeyBindingsType);
rv = inst->QueryInterface(aIID, aResult);
NS_RELEASE(inst);
--- a/widget/src/os2/nsRwsService.cpp
+++ b/widget/src/os2/nsRwsService.cpp
@@ -1212,17 +1212,17 @@ static nsresult nsRwsServiceInit(nsRwsSe
else
if (userTO == 0) {
rc = sRwsSetTimeout(2);
if (rc)
ERRMSG(rc, "RwsSetTimeout")
}
// create an instance of nsRwsService
- NS_NEWXPCOM(sRwsInstance, nsRwsService);
+ sRwsInstance = new nsRwsService();
if (sRwsInstance == 0)
return NS_ERROR_OUT_OF_MEMORY;
*aClass = sRwsInstance;
NS_ADDREF(*aClass);
// set the class up as a shutdown observer
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
--- a/widget/src/qt/nsWidgetFactory.cpp
+++ b/widget/src/qt/nsWidgetFactory.cpp
@@ -90,17 +90,17 @@ nsNativeThemeQtConstructor(nsISupports *
if (gDisableNativeTheme)
return NS_ERROR_NO_INTERFACE;
*aResult = NULL;
if (NULL != aOuter)
return NS_ERROR_NO_AGGREGATION;
- NS_NEWXPCOM(inst, nsNativeThemeQt);
+ inst = new nsNativeThemeQt();
if (NULL == inst)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(inst);
rv = inst->QueryInterface(aIID, aResult);
NS_RELEASE(inst);
return rv;
--- a/xpcom/base/nsAgg.h
+++ b/xpcom/base/nsAgg.h
@@ -150,17 +150,17 @@ NS_IMETHODIMP_(nsrefcnt)
{ \
_class* agg = (_class*)((char*)(this) - offsetof(_class, fAggregated)); \
NS_PRECONDITION(0 != agg->mRefCnt, "dup release"); \
NS_ASSERT_OWNINGTHREAD(_class); \
--agg->mRefCnt; \
NS_LOG_RELEASE(this, agg->mRefCnt, #_class); \
if (agg->mRefCnt == 0) { \
agg->mRefCnt = 1; /* stabilize */ \
- NS_DELETEXPCOM(agg); \
+ delete agg; \
return 0; \
} \
return agg->mRefCnt; \
} \
#define NS_IMPL_CYCLE_COLLECTING_AGGREGATED(_class) \
\
NS_IMPL_AGGREGATED_HELPER(_class) \
@@ -183,17 +183,17 @@ NS_IMETHODIMP_(nsrefcnt)
_class* agg = NS_CYCLE_COLLECTION_CLASSNAME(_class)::Downcast(this); \
NS_PRECONDITION(0 != agg->mRefCnt, "dup release"); \
NS_CheckThreadSafe(agg->_mOwningThread.GetThread(), \
#_class " not thread-safe"); \
nsrefcnt count = agg->mRefCnt.decr(this); \
NS_LOG_RELEASE(this, count, #_class); \
if (count == 0) { \
agg->mRefCnt.stabilizeForDeletion(this); \
- NS_DELETEXPCOM(agg); \
+ delete agg; \
return 0; \
} \
return count; \
}
#define NS_IMPL_AGGREGATED_HELPER(_class) \
NS_IMETHODIMP \
_class::QueryInterface(const nsIID& aIID, void** aInstancePtr) \
--- a/xpcom/base/nsTraceRefcntImpl.cpp
+++ b/xpcom/base/nsTraceRefcntImpl.cpp
@@ -979,17 +979,17 @@ NS_LogAddRef(void* aPtr, nsrefcnt aRefcn
if (gBloatLog) {
BloatEntry* entry = GetBloatEntry(aClazz, classSize);
if (entry) {
entry->AddRef(aRefcnt);
}
}
- // Here's the case where neither NS_NEWXPCOM nor MOZ_COUNT_CTOR were used,
+ // Here's the case where MOZ_COUNT_CTOR was not used,
// yet we still want to see creation information:
PRBool loggingThisType = (!gTypesToLog || LogThisType(aClazz));
PRInt32 serialno = 0;
if (gSerialNumbers && loggingThisType) {
serialno = GetSerialNumber(aPtr, aRefcnt == 1);
NS_ASSERTION(serialno != 0,
"Serial number requested for unrecognized pointer! "
@@ -1063,17 +1063,17 @@ NS_LogRelease(void* aPtr, nsrefcnt aRefc
// Can't use PR_LOG(), b/c it truncates the line
fprintf(gRefcntsLog,
"\n<%s> 0x%08X %d Release %d\n", aClazz, NS_PTR_TO_INT32(aPtr), serialno, aRefcnt);
nsTraceRefcntImpl::WalkTheStack(gRefcntsLog);
fflush(gRefcntsLog);
}
}
- // Here's the case where neither NS_DELETEXPCOM nor MOZ_COUNT_DTOR were used,
+ // Here's the case where MOZ_COUNT_DTOR was not used,
// yet we still want to see deletion information:
if (aRefcnt == 0 && gAllocLog && loggingThisType && loggingThisObject) {
fprintf(gAllocLog,
"\n<%s> 0x%08X %d Destroy\n",
aClazz, NS_PTR_TO_INT32(aPtr), serialno);
nsTraceRefcntImpl::WalkTheStack(gAllocLog);
}
--- a/xpcom/glue/nsIGenericFactory.h
+++ b/xpcom/glue/nsIGenericFactory.h
@@ -374,17 +374,17 @@ static NS_IMETHODIMP
_InstanceClass * inst; \
\
*aResult = NULL; \
if (NULL != aOuter) { \
rv = NS_ERROR_NO_AGGREGATION; \
return rv; \
} \
\
- NS_NEWXPCOM(inst, _InstanceClass); \
+ inst = new _InstanceClass(); \
if (NULL == inst) { \
rv = NS_ERROR_OUT_OF_MEMORY; \
return rv; \
} \
NS_ADDREF(inst); \
rv = inst->QueryInterface(aIID, aResult); \
NS_RELEASE(inst); \
\
@@ -402,17 +402,17 @@ static NS_IMETHODIMP
_InstanceClass * inst; \
\
*aResult = NULL; \
if (NULL != aOuter) { \
rv = NS_ERROR_NO_AGGREGATION; \
return rv; \
} \
\
- NS_NEWXPCOM(inst, _InstanceClass); \
+ inst = new _InstanceClass(); \
if (NULL == inst) { \
rv = NS_ERROR_OUT_OF_MEMORY; \
return rv; \
} \
NS_ADDREF(inst); \
rv = inst->_InitMethod(); \
if(NS_SUCCEEDED(rv)) { \
rv = inst->QueryInterface(aIID, aResult); \
--- a/xpcom/glue/nsISupportsImpl.h
+++ b/xpcom/glue/nsISupportsImpl.h
@@ -322,17 +322,17 @@ public:
} \
void Release(void) { \
NS_PRECONDITION(0 != mRefCnt, "dup release"); \
NS_ASSERT_OWNINGTHREAD(_class); \
--mRefCnt; \
NS_LOG_RELEASE(this, mRefCnt, #_class); \
if (mRefCnt == 0) { \
mRefCnt = 1; /* stabilize */ \
- NS_DELETEXPCOM(this); \
+ delete this; \
} \
} \
protected: \
nsAutoRefCnt mRefCnt; \
NS_DECL_OWNINGTHREAD \
public:
/**
@@ -406,17 +406,17 @@ NS_IMETHODIMP_(nsrefcnt) _class::Release
* destructor may trigger code that attempts to QueryInterface() and
* Release() 'this' again. Doing so will temporarily increment and
* decrement the refcount. (Only a logic error would make one try to
* keep a permanent hold on 'this'.) To prevent re-entering the
* destructor, we make sure that no balanced refcounting can return
* the refcount to |0|.
*/
#define NS_IMPL_RELEASE(_class) \
- NS_IMPL_RELEASE_WITH_DESTROY(_class, NS_DELETEXPCOM(this))
+ NS_IMPL_RELEASE_WITH_DESTROY(_class, delete (this))
/**
* Use this macro to implement the Release method for a given <i>_class</i>
* implemented as a wholly owned aggregated object intended to implement
* interface(s) for its owner
* @param _class The name of the class implementing the method
* @param _aggregator the owning/containing object
*/
@@ -460,20 +460,20 @@ NS_IMETHODIMP_(nsrefcnt) _class::Release
#define NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_DESTROY(_class, _destroy) \
NS_IMPL_CYCLE_COLLECTING_RELEASE_FULL(_class, _class, _destroy)
#define NS_IMPL_CYCLE_COLLECTING_RELEASE_AMBIGUOUS_WITH_DESTROY(_class, _basetype, _destroy) \
NS_IMPL_CYCLE_COLLECTING_RELEASE_FULL(_class, _basetype, _destroy)
#define NS_IMPL_CYCLE_COLLECTING_RELEASE_AMBIGUOUS(_class, _basetype) \
- NS_IMPL_CYCLE_COLLECTING_RELEASE_FULL(_class, _basetype, NS_DELETEXPCOM(this))
+ NS_IMPL_CYCLE_COLLECTING_RELEASE_FULL(_class, _basetype, delete (this))
#define NS_IMPL_CYCLE_COLLECTING_RELEASE(_class) \
- NS_IMPL_CYCLE_COLLECTING_RELEASE_FULL(_class, _class, NS_DELETEXPCOM(this))
+ NS_IMPL_CYCLE_COLLECTING_RELEASE_FULL(_class, _class, delete (this))
///////////////////////////////////////////////////////////////////////////////
/**
* There are two ways of implementing QueryInterface, and we use both:
*
* Table-driven QueryInterface uses a static table of IID->offset mappings
@@ -1273,17 +1273,17 @@ NS_IMETHODIMP_(nsrefcnt) _class::Release
nsrefcnt count; \
NS_PRECONDITION(0 != mRefCnt, "dup release"); \
count = PR_AtomicDecrement((PRInt32 *)&mRefCnt); \
NS_LOG_RELEASE(this, count, #_class); \
if (0 == count) { \
mRefCnt = 1; /* stabilize */ \
/* enable this to find non-threadsafe destructors: */ \
/* NS_ASSERT_OWNINGTHREAD(_class); */ \
- NS_DELETEXPCOM(this); \
+ delete (this); \
return 0; \
} \
return count; \
}
#else // XPCOM_GLUE_AVOID_NSPR
#define NS_IMPL_THREADSAFE_ADDREF(_class) \
--- a/xpcom/glue/nsISupportsUtils.h
+++ b/xpcom/glue/nsISupportsUtils.h
@@ -57,37 +57,16 @@
#include "nsDebug.h"
#endif
#ifndef nsISupportsImpl_h__
#include "nsISupportsImpl.h"
#endif
/**
- * Macro for instantiating a new object that implements nsISupports.
- * Note that you can only use this if you adhere to the no arguments
- * constructor com policy (which you really should!).
- * @param _result Where the new instance pointer is stored
- * @param _type The type of object to call "new" with.
- */
-#define NS_NEWXPCOM(_result,_type) \
- PR_BEGIN_MACRO \
- _result = new _type(); \
- PR_END_MACRO
-
-/**
- * Macro for deleting an object that implements nsISupports.
- * @param _ptr The object to delete.
- */
-#define NS_DELETEXPCOM(_ptr) \
- PR_BEGIN_MACRO \
- delete (_ptr); \
- PR_END_MACRO
-
-/**
* Macro for adding a reference to an interface.
* @param _ptr The interface pointer.
*/
#define NS_ADDREF(_ptr) \
(_ptr)->AddRef()
/**
* Macro for adding a reference to this. This macro should be used
--- a/xpcom/io/nsInputStreamTee.cpp
+++ b/xpcom/io/nsInputStreamTee.cpp
@@ -301,18 +301,17 @@ nsInputStreamTee::GetEventTarget(nsIEven
NS_COM nsresult
NS_NewInputStreamTeeAsync(nsIInputStream **result,
nsIInputStream *source,
nsIOutputStream *sink,
nsIEventTarget *anEventTarget)
{
nsresult rv;
- nsCOMPtr<nsIInputStreamTee> tee;
- NS_NEWXPCOM(tee, nsInputStreamTee);
+ nsCOMPtr<nsIInputStreamTee> tee = new nsInputStreamTee();
if (!tee)
return NS_ERROR_OUT_OF_MEMORY;
rv = tee->SetSource(source);
if (NS_FAILED(rv)) return rv;
rv = tee->SetSink(sink);
if (NS_FAILED(rv)) return rv;
--- a/xpcom/io/nsMultiplexInputStream.cpp
+++ b/xpcom/io/nsMultiplexInputStream.cpp
@@ -393,18 +393,17 @@ nsMultiplexInputStreamConstructor(nsISup
REFNSIID iid,
void **result)
{
*result = nsnull;
if (outer)
return NS_ERROR_NO_AGGREGATION;
- nsMultiplexInputStream *inst;
- NS_NEWXPCOM(inst, nsMultiplexInputStream);
+ nsMultiplexInputStream *inst = new nsMultiplexInputStream();
if (!inst)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(inst);
nsresult rv = inst->QueryInterface(iid, result);
NS_RELEASE(inst);
return rv;
--- a/xpcom/proxy/src/nsProxyEventObject.cpp
+++ b/xpcom/proxy/src/nsProxyEventObject.cpp
@@ -108,17 +108,17 @@ nsProxyEventObject::Release(void)
if (mRefCnt)
return mRefCnt;
mProxyObject->LockedRemove(this);
}
// call the destructor outside of the lock so that we aren't holding the
// lock when we release the object
- NS_DELETEXPCOM(this);
+ delete this;
return 0;
}
NS_IMETHODIMP
nsProxyEventObject::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if( aIID.Equals(GetClass()->GetProxiedIID()) )
{
--- a/xpcom/reflect/xptinfo/src/xptiInterfaceInfo.cpp
+++ b/xpcom/reflect/xptinfo/src/xptiInterfaceInfo.cpp
@@ -697,15 +697,15 @@ xptiInterfaceInfo::Release(void)
return 1;
if(mEntry)
{
mEntry->LockedInterfaceInfoDeathNotification();
mEntry = nsnull;
}
- NS_DELETEXPCOM(this);
+ delete this;
return 0;
}
return cnt;
}
/***************************************************************************/
--- a/xpcom/tests/TestCOMArray.cpp
+++ b/xpcom/tests/TestCOMArray.cpp
@@ -145,17 +145,17 @@ Bar::Release(void)
{
++Bar::sReleaseCalled;
NS_PRECONDITION(0 != mRefCnt, "dup release");
NS_ASSERT_OWNINGTHREAD(_class);
--mRefCnt;
NS_LOG_RELEASE(this, mRefCnt, "Bar");
if (mRefCnt == 0) {
mRefCnt = 1; /* stabilize */
- NS_DELETEXPCOM(this);
+ delete this;
return 0;
}
return mRefCnt;
}
int main(int argc, char **argv)
{
--- a/xpcom/threads/nsTimerImpl.cpp
+++ b/xpcom/threads/nsTimerImpl.cpp
@@ -86,17 +86,17 @@ NS_IMETHODIMP_(nsrefcnt) nsTimerImpl::Re
NS_PRECONDITION(0 != mRefCnt, "dup release");
count = PR_AtomicDecrement((PRInt32 *)&mRefCnt);
NS_LOG_RELEASE(this, count, "nsTimerImpl");
if (count == 0) {
mRefCnt = 1; /* stabilize */
/* enable this to find non-threadsafe destructors: */
/* NS_ASSERT_OWNINGTHREAD(nsTimerImpl); */
- NS_DELETEXPCOM(this);
+ delete this;
return 0;
}
// If only one reference remains, and mArmed is set, then the ref must be
// from the TimerThread::mTimers array, so we Cancel this timer to remove
// the mTimers element, and return 0 if Cancel in fact disarmed the timer.
//
// We use an inlined version of nsTimerImpl::Cancel here to check for the