Bug 1415799 - Rename pref_HashPref() as pref_SetPref(). r=glandium. draft
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 09 Nov 2017 18:00:42 +1100
changeset 695474 c19957e7b6f84306d0efd91d0d19dfe850e55b07
parent 695473 1892d7ed839124376a4a4a42846000d25fb338b1
child 739593 812822855158bbf8836456be6a2f3ee02dc41c4a
push id88417
push usernnethercote@mozilla.com
push dateThu, 09 Nov 2017 07:02:38 +0000
reviewersglandium
bugs1415799
milestone58.0a1
Bug 1415799 - Rename pref_HashPref() as pref_SetPref(). r=glandium. Because it sets the pref. MozReview-Commit-ID: IlEVRWKU94X
modules/libpref/Preferences.cpp
--- a/modules/libpref/Preferences.cpp
+++ b/modules/libpref/Preferences.cpp
@@ -352,20 +352,20 @@ pref_DoCallback(const char* aChangedPref
 enum
 {
   kPrefSetDefault = 1,
   kPrefForceSet = 2,
   kPrefStickyDefault = 4,
 };
 
 static nsresult
-pref_HashPref(const char* aKey,
-              PrefValue aValue,
-              PrefType aType,
-              uint32_t aFlags);
+pref_SetPref(const char* aKey,
+             PrefValue aValue,
+             PrefType aType,
+             uint32_t aFlags);
 
 #define PREF_HASHTABLE_INITIAL_LENGTH 1024
 
 // Assign to aResult a quoted, escaped copy of aOriginal.
 static void
 StrEscape(const char* aOriginal, nsCString& aResult)
 {
   if (aOriginal == nullptr) {
@@ -436,44 +436,44 @@ PREF_SetCStringPref(const char* aPrefNam
                     const nsACString& aValue,
                     bool aSetDefault)
 {
   if (aValue.Length() > MAX_PREF_LENGTH) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   // It's ok to stash a pointer to the temporary PromiseFlatCString's chars in
-  // pref because pref_HashPref() duplicates those chars.
+  // pref because pref_SetPref() duplicates those chars.
   PrefValue pref;
   const nsCString& flat = PromiseFlatCString(aValue);
   pref.mStringVal = flat.get();
 
-  return pref_HashPref(
+  return pref_SetPref(
     aPrefName, pref, PrefType::String, aSetDefault ? kPrefSetDefault : 0);
 }
 
 // Like PREF_SetCStringPref(), but for integers.
 static nsresult
 PREF_SetIntPref(const char* aPrefName, int32_t aValue, bool aSetDefault)
 {
   PrefValue pref;
   pref.mIntVal = aValue;
 
-  return pref_HashPref(
+  return pref_SetPref(
     aPrefName, pref, PrefType::Int, aSetDefault ? kPrefSetDefault : 0);
 }
 
 // Like PREF_SetCStringPref(), but for booleans.
 static nsresult
 PREF_SetBoolPref(const char* aPrefName, bool aValue, bool aSetDefault)
 {
   PrefValue pref;
   pref.mBoolVal = aValue;
 
-  return pref_HashPref(
+  return pref_SetPref(
     aPrefName, pref, PrefType::Bool, aSetDefault ? kPrefSetDefault : 0);
 }
 
 enum WhichValue
 {
   DEFAULT_VALUE,
   USER_VALUE
 };
@@ -919,20 +919,20 @@ pref_HashTableLookup(const char* aKey)
       "accessing non-init pref %s before the rest of the prefs are sent", aKey);
   }
 #endif
 
   return static_cast<PrefHashEntry*>(gHashTable->Search(aKey));
 }
 
 static nsresult
-pref_HashPref(const char* aKey,
-              PrefValue aValue,
-              PrefType aType,
-              uint32_t aFlags)
+pref_SetPref(const char* aKey,
+             PrefValue aValue,
+             PrefType aType,
+             uint32_t aFlags)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   if (!gHashTable) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   auto pref = static_cast<PrefHashEntry*>(gHashTable->Add(aKey, fallible));
@@ -1191,17 +1191,17 @@ PREF_ReaderCallback(void* aClosure,
   if (aIsDefault) {
     flags |= kPrefSetDefault;
     if (aIsStickyDefault) {
       flags |= kPrefStickyDefault;
     }
   } else {
     flags |= kPrefForceSet;
   }
-  pref_HashPref(aPref, aValue, aType, flags);
+  pref_SetPref(aPref, aValue, aType, flags);
 }
 
 //===========================================================================
 // Prefs parsing
 //===========================================================================
 
 // Callback function used to notify consumer of preference name value pairs.
 // The pref name and value must be copied by the implementor of the callback