Bug 1268772 (part 3) - Remove NS_NewWindowsRegKey()'s return value. r=erahm.
authorNicholas Nethercote <nnethercote@mozilla.com>
Mon, 02 May 2016 09:06:45 +1000
changeset 295703 a2061ce934cbd547eb692165d819224a40d940c8
parent 295702 4cbd94383852a0f3840d59b951fc6b45f9e64d01
child 295704 ca1b48e0c972772ddad2708febc86f3ab10c5c28
push id19015
push usercbook@mozilla.com
push dateMon, 02 May 2016 09:39:23 +0000
treeherderfx-team@2080375bc69d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerserahm
bugs1268772
milestone49.0a1
Bug 1268772 (part 3) - Remove NS_NewWindowsRegKey()'s return value. r=erahm. It's always NS_OK. The patch also removes an unnecessary failure check as a result.
xpcom/ds/nsWindowsRegKey.cpp
xpcom/ds/nsWindowsRegKey.h
--- a/xpcom/ds/nsWindowsRegKey.cpp
+++ b/xpcom/ds/nsWindowsRegKey.cpp
@@ -551,33 +551,29 @@ NS_IMETHODIMP
 nsWindowsRegKey::IsWatching(bool* aResult)
 {
   *aResult = (mWatchEvent != nullptr);
   return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 
-nsresult
+void
 NS_NewWindowsRegKey(nsIWindowsRegKey** aResult)
 {
   RefPtr<nsWindowsRegKey> key = new nsWindowsRegKey();
   key.forget(aResult);
-  return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 
 nsresult
 nsWindowsRegKeyConstructor(nsISupports* aDelegate, const nsIID& aIID,
                            void** aResult)
 {
   if (aDelegate) {
     return NS_ERROR_NO_AGGREGATION;
   }
 
   nsCOMPtr<nsIWindowsRegKey> key;
-  nsresult rv = NS_NewWindowsRegKey(getter_AddRefs(key));
-  if (NS_SUCCEEDED(rv)) {
-    rv = key->QueryInterface(aIID, aResult);
-  }
-  return rv;
+  NS_NewWindowsRegKey(getter_AddRefs(key));
+  return key->QueryInterface(aIID, aResult);
 }
--- a/xpcom/ds/nsWindowsRegKey.h
+++ b/xpcom/ds/nsWindowsRegKey.h
@@ -16,27 +16,28 @@
  * via the XPCOM component manager.
  */
 #define NS_WINDOWSREGKEY_CONTRACTID "@mozilla.org/windows-registry-key;1"
 
 /**
  * This function may be used to instantiate a windows registry key object prior
  * to XPCOM being initialized.
  */
-extern "C" nsresult NS_NewWindowsRegKey(nsIWindowsRegKey** aResult);
+extern "C" void NS_NewWindowsRegKey(nsIWindowsRegKey** aResult);
 
 //-----------------------------------------------------------------------------
 
 #ifdef IMPL_LIBXUL
 
 // a53bc624-d577-4839-b8ec-bb5040a52ff4
 #define NS_WINDOWSREGKEY_CID \
   { 0xa53bc624, 0xd577, 0x4839, \
     { 0xb8, 0xec, 0xbb, 0x50, 0x40, 0xa5, 0x2f, 0xf4 } }
 
-extern nsresult nsWindowsRegKeyConstructor(nsISupports* aOuter,
-                                           const nsIID& aIID, void** aResult);
+extern MOZ_MUST_USE nsresult nsWindowsRegKeyConstructor(nsISupports* aOuter,
+                                                        const nsIID& aIID,
+                                                        void** aResult);
 
 #endif  // IMPL_LIBXUL
 
 //-----------------------------------------------------------------------------
 
 #endif  // nsWindowsRegKey_h__