Bug 1210463 - part 1 - Remove some unneeded null checks on new in ModuleUtils. r=froydnj
authorAndrew McCreight <continuation@gmail.com>
Thu, 01 Oct 2015 15:53:38 -0700
changeset 265567 02581fcdff44d580dc43a9c3d2f6af3ce892f335
parent 265566 f49b6f48c99381753b01e0dc43a666774301af3d
child 265568 15fe8692377c2a77672cd95f52164a4bc3b2c37f
push id65980
push useramccreight@mozilla.com
push dateThu, 01 Oct 2015 22:55:25 +0000
treeherdermozilla-inbound@c78163472ef7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1210463
milestone44.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 1210463 - part 1 - Remove some unneeded null checks on new in ModuleUtils. r=froydnj
xpcom/components/ModuleUtils.h
--- a/xpcom/components/ModuleUtils.h
+++ b/xpcom/components/ModuleUtils.h
@@ -20,20 +20,16 @@ static nsresult                         
                                                                               \
     *aResult = nullptr;                                                       \
     if (nullptr != aOuter) {                                                  \
         rv = NS_ERROR_NO_AGGREGATION;                                         \
         return rv;                                                            \
     }                                                                         \
                                                                               \
     inst = new _InstanceClass();                                              \
-    if (nullptr == inst) {                                                    \
-        rv = NS_ERROR_OUT_OF_MEMORY;                                          \
-        return rv;                                                            \
-    }                                                                         \
     NS_ADDREF(inst);                                                          \
     rv = inst->QueryInterface(aIID, aResult);                                 \
     NS_RELEASE(inst);                                                         \
                                                                               \
     return rv;                                                                \
 }
 
 #define NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(_InstanceClass, _InitMethod)      \
@@ -47,20 +43,16 @@ static nsresult                         
                                                                               \
     *aResult = nullptr;                                                       \
     if (nullptr != aOuter) {                                                  \
         rv = NS_ERROR_NO_AGGREGATION;                                         \
         return rv;                                                            \
     }                                                                         \
                                                                               \
     inst = new _InstanceClass();                                              \
-    if (nullptr == inst) {                                                    \
-        rv = NS_ERROR_OUT_OF_MEMORY;                                          \
-        return rv;                                                            \
-    }                                                                         \
     NS_ADDREF(inst);                                                          \
     rv = inst->_InitMethod();                                                 \
     if(NS_SUCCEEDED(rv)) {                                                    \
         rv = inst->QueryInterface(aIID, aResult);                             \
     }                                                                         \
     NS_RELEASE(inst);                                                         \
                                                                               \
     return rv;                                                                \