Bug 316661 - Remove null-checks before delete: Part B; r=pbiggar,brendan,bzbarsky
authorEd Morley <bmo@edmorley.co.uk>
Wed, 01 Jun 2011 03:07:00 -0700
changeset 71179 38f994208a4698546db7b9ea6bb49a96b0587211
parent 71178 ea71b04c158be85de4f29b753ef3f76dcc7d3392
child 71180 7e6f3b1796441e3cb3a2ae87d43bf793a46580a3
push id159
push usereakhgari@mozilla.com
push dateTue, 16 Aug 2011 17:53:11 +0000
treeherdermozilla-beta@8786e3e49240 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspbiggar, brendan, bzbarsky
bugs316661
milestone6.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 316661 - Remove null-checks before delete: Part B; r=pbiggar,brendan,bzbarsky
js/jsd/jsd_xpc.cpp
js/src/xpconnect/src/xpcjsruntime.cpp
js/src/xpconnect/src/xpcthreadcontext.cpp
--- a/js/jsd/jsd_xpc.cpp
+++ b/js/jsd/jsd_xpc.cpp
@@ -1014,20 +1014,18 @@ jsdScript::jsdScript (JSDContext *aCx, J
         
         mValid = PR_TRUE;
     }
 }
 
 jsdScript::~jsdScript () 
 {
     DEBUG_DESTROY ("jsdScript", gScriptCount);
-    if (mFileName)
-        delete mFileName;
-    if (mFunctionName)
-        delete mFunctionName;
+    delete mFileName;
+    delete mFunctionName;
 
     if (mPPLineMap)
         PR_Free(mPPLineMap);
 
     /* Invalidate() needs to be called to release an owning reference to
      * ourselves, so if we got here without being invalidated, something
      * has gone wrong with our ref count. */
     NS_ASSERTION (!mValid, "Script destroyed without being invalidated.");
--- a/js/src/xpconnect/src/xpcjsruntime.cpp
+++ b/js/src/xpconnect/src/xpcjsruntime.cpp
@@ -241,20 +241,18 @@ ContextCallback(JSContext *cx, uintN ope
             delete XPCContext::GetXPCContext(cx);
         }
     }
     return JS_TRUE;
 }
 
 xpc::CompartmentPrivate::~CompartmentPrivate()
 {
-    if (waiverWrapperMap)
-        delete waiverWrapperMap;
-    if (expandoMap)
-        delete expandoMap;
+    delete waiverWrapperMap;
+    delete expandoMap;
 }
 
 static JSBool
 CompartmentCallback(JSContext *cx, JSCompartment *compartment, uintN op)
 {
     JS_ASSERT(op == JSCOMPARTMENT_DESTROY);
 
     XPCJSRuntime* self = nsXPConnect::GetRuntimeInstance();
--- a/js/src/xpconnect/src/xpcthreadcontext.cpp
+++ b/js/src/xpconnect/src/xpcthreadcontext.cpp
@@ -416,18 +416,17 @@ XPCPerThreadData::~XPCPerThreadData()
         gLock = nsnull;
     }
 }
 
 static void
 xpc_ThreadDataDtorCB(void* ptr)
 {
     XPCPerThreadData* data = (XPCPerThreadData*) ptr;
-    if(data)
-        delete data;
+    delete data;
 }
 
 void XPCPerThreadData::TraceJS(JSTracer *trc)
 {
 #ifdef XPC_TRACK_AUTOMARKINGPTR_STATS
     {
         static int maxLength = 0;
         int length = 0;
@@ -479,18 +478,17 @@ XPCPerThreadData::GetDataImpl(JSContext 
 
     data = (XPCPerThreadData*) PR_GetThreadPrivate(gTLSIndex);
     if(!data)
     {
         data = new XPCPerThreadData();
         if(!data || !data->IsValid())
         {
             NS_ERROR("new XPCPerThreadData() failed!");
-            if(data)
-                delete data;
+            delete data;
             return nsnull;
         }
         if(PR_FAILURE == PR_SetThreadPrivate(gTLSIndex, data))
         {
             NS_ERROR("PR_SetThreadPrivate failed!");
             delete data;
             return nsnull;
         }