Bug 1221376 - Remove PL_DHASH_STOP. r=froydnj.
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 03 Nov 2015 17:22:15 -0800
changeset 310686 8f3e93fe5121e38c2c0e30118ef0becd641a0f62
parent 310685 d61fe2e3bf057463fe63f67094dfa39100114c55
child 310687 3f51676191a6be10a6321edd49662a73a21e381d
push id7764
push usergarndt@mozilla.com
push dateMon, 23 Nov 2015 16:05:29 +0000
reviewersfroydnj
bugs1221376
milestone45.0a1
Bug 1221376 - Remove PL_DHASH_STOP. r=froydnj. All uses of it have been removed.
xpcom/glue/nsBaseHashtable.h
--- a/xpcom/glue/nsBaseHashtable.h
+++ b/xpcom/glue/nsBaseHashtable.h
@@ -2,29 +2,29 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsBaseHashtable_h__
 #define nsBaseHashtable_h__
 
+#include "mozilla/DebugOnly.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/Move.h"
 #include "nsTHashtable.h"
 #include "nsDebug.h"
 
 // These are the codes returned by |EnumReadFunction| and |EnumFunction|, which
 // control the behavior of EnumerateRead() and Enumerate(). The PLD/PL_D prefix
 // is because they originated in PLDHashTable, but that class no longer uses
 // them.
 enum PLDHashOperator
 {
   PL_DHASH_NEXT = 0,          // enumerator says continue
-  PL_DHASH_STOP = 1,          // enumerator says stop
   PL_DHASH_REMOVE = 2         // enumerator says remove
 };
 
 template<class KeyClass, class DataType, class UserDataType>
 class nsBaseHashtable; // forward declaration
 
 /**
  * the private nsTHashtable::EntryType class used by nsBaseHashtable
@@ -157,55 +157,50 @@ public:
    */
   void Remove(KeyType aKey) { this->RemoveEntry(aKey); }
 
   /**
    * function type provided by the application for enumeration.
    * @param aKey the key being enumerated
    * @param aData data being enumerated
    * @param aUserArg passed unchanged from Enumerate
-   * @return either
-   *   @link PLDHashOperator::PL_DHASH_NEXT PL_DHASH_NEXT @endlink or
-   *   @link PLDHashOperator::PL_DHASH_STOP PL_DHASH_STOP @endlink
+   * @return @link PLDHashOperator::PL_DHASH_NEXT PL_DHASH_NEXT @endlink
    */
   typedef PLDHashOperator (*EnumReadFunction)(KeyType aKey,
                                               UserDataType aData,
                                               void* aUserArg);
 
   /**
    * enumerate entries in the hashtable, without allowing changes
    * WARNING: this function is deprecated. Please use Iterator instead.
    * @param aEnumFunc enumeration callback
    * @param aUserArg passed unchanged to the EnumReadFunction
    */
   uint32_t EnumerateRead(EnumReadFunction aEnumFunc, void* aUserArg) const
   {
     uint32_t n = 0;
     for (auto iter = this->mTable.ConstIter(); !iter.Done(); iter.Next()) {
       auto entry = static_cast<EntryType*>(iter.Get());
-      PLDHashOperator op = aEnumFunc(entry->GetKey(), entry->mData, aUserArg);
+      mozilla::DebugOnly<PLDHashOperator> op =
+        aEnumFunc(entry->GetKey(), entry->mData, aUserArg);
       n++;
       MOZ_ASSERT(!(op & PL_DHASH_REMOVE));
-      if (op & PL_DHASH_STOP) {
-        break;
-      }
     }
     return n;
   }
 
   /**
    * function type provided by the application for enumeration.
    * @param aKey the key being enumerated
    * @param aData Reference to data being enumerated, may be altered. e.g. for
    *        nsInterfaceHashtable this is an nsCOMPtr reference...
    * @parm aUserArg passed unchanged from Enumerate
    * @return bitflag combination of
-   *   @link PLDHashOperator::PL_DHASH_REMOVE @endlink,
-   *   @link PLDHashOperator::PL_DHASH_NEXT PL_DHASH_NEXT @endlink, or
-   *   @link PLDHashOperator::PL_DHASH_STOP PL_DHASH_STOP @endlink
+   *   @link PLDHashOperator::PL_DHASH_REMOVE @endlink or
+   *   @link PLDHashOperator::PL_DHASH_NEXT PL_DHASH_NEXT @endlink
    */
   typedef PLDHashOperator (*EnumFunction)(KeyType aKey,
                                           DataType& aData,
                                           void* aUserArg);
 
   /**
    * enumerate entries in the hashtable, allowing changes.
    * WARNING: this function is deprecated. Please use Iterator and/or
@@ -218,19 +213,16 @@ public:
     uint32_t n = 0;
     for (auto iter = this->mTable.Iter(); !iter.Done(); iter.Next()) {
       auto entry = static_cast<EntryType*>(iter.Get());
       PLDHashOperator op = aEnumFunc(entry->GetKey(), entry->mData, aUserArg);
       n++;
       if (op & PL_DHASH_REMOVE) {
         iter.Remove();
       }
-      if (op & PL_DHASH_STOP) {
-        break;
-      }
     }
     return n;
   }
 
   // This is an iterator that also allows entry removal. Example usage:
   //
   //   for (auto iter = table.Iter(); !iter.Done(); iter.Next()) {
   //     const KeyType key = iter.Key();