Bug 1181443 (part 3, attempt 2) - Remove nsTHashtable::EnumerateEntries(), which is no longer used. r=froydnj.
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 23 Jul 2015 02:37:26 -0700
changeset 284716 0006b20bdca90bf18c9e4aee307f56e66d676ad9
parent 284715 04da73b234d5b17b14507e4802d4a9de99af7127
child 284717 e9906ce9db6fe49213a23fdb4242ac915f059b9c
push id4324
push userbcampen@mozilla.com
push dateWed, 12 Aug 2015 18:57:23 +0000
reviewersfroydnj
bugs1181443
milestone43.0a1
Bug 1181443 (part 3, attempt 2) - Remove nsTHashtable::EnumerateEntries(), which is no longer used. r=froydnj.
xpcom/glue/nsBaseHashtable.h
xpcom/glue/nsTHashtable.h
--- a/xpcom/glue/nsBaseHashtable.h
+++ b/xpcom/glue/nsBaseHashtable.h
@@ -8,16 +8,27 @@
 #define nsBaseHashtable_h__
 
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/Move.h"
 #include "nsTHashtable.h"
 #include "prlock.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
  * @see nsTHashtable for the specification of this class
  * @see nsBaseHashtable for template parameters
  */
--- a/xpcom/glue/nsTHashtable.h
+++ b/xpcom/glue/nsTHashtable.h
@@ -67,26 +67,16 @@
  *   }</pre>
  *
  * @see nsInterfaceHashtable
  * @see nsDataHashtable
  * @see nsClassHashtable
  * @author "Benjamin Smedberg <bsmedberg@covad.net>"
  */
 
-// These are the codes returned by |Enumerator| functions, which control
-// EnumerateEntry()'s behavior. 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 EntryType>
 class MOZ_NEEDS_NO_VTABLE_TYPE nsTHashtable
 {
   typedef mozilla::fallible_t fallible_t;
 
 public:
   // Separate constructors instead of default aInitLength parameter since
   // otherwise the default no-arg constructor isn't found.
@@ -184,56 +174,16 @@ public:
    * @param aEntry   the entry-pointer to remove (obtained from GetEntry or
    *                 the enumerator
    */
   void RawRemoveEntry(EntryType* aEntry)
   {
     PL_DHashTableRawRemove(&mTable, aEntry);
   }
 
-  /**
-   * client must provide an <code>Enumerator</code> function for
-   *   EnumerateEntries
-   * @param     aEntry the entry being enumerated
-   * @param     userArg passed unchanged from <code>EnumerateEntries</code>
-   * @return    combination of flags
-   *            @link PLDHashOperator::PL_DHASH_NEXT PL_DHASH_NEXT @endlink ,
-   *            @link PLDHashOperator::PL_DHASH_STOP PL_DHASH_STOP @endlink ,
-   *            @link PLDHashOperator::PL_DHASH_REMOVE PL_DHASH_REMOVE @endlink
-   */
-  typedef PLDHashOperator (*Enumerator)(EntryType* aEntry, void* userArg);
-
-  /**
-   * Enumerate all the entries of the function. If any entries are removed via
-   * a PL_DHASH_REMOVE return value from |aEnumFunc|, the table may be shrunk
-   * at the end. Use RawRemoveEntry() instead if you wish to remove an entry
-   * without possibly shrinking the table.
-   * WARNING: this function is deprecated. Please use Iterator instead.
-   * @param     enumFunc the <code>Enumerator</code> function to call
-   * @param     userArg a pointer to pass to the
-   *            <code>Enumerator</code> function
-   * @return    the number of entries actually enumerated
-   */
-  uint32_t EnumerateEntries(Enumerator aEnumFunc, void* aUserArg)
-  {
-    uint32_t n = 0;
-    for (auto iter = mTable.Iter(); !iter.Done(); iter.Next()) {
-      auto entry = static_cast<EntryType*>(iter.Get());
-      PLDHashOperator op = aEnumFunc(entry, 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()) {
   //     Entry* entry = iter.Get();
   //     // ... do stuff with |entry| ...
   //     // ... possibly call iter.Remove() once ...
   //   }
   //