Bug 1338518 - Followup: Fix incorrect `if` block in SetMemoryGCSliceTimePrefChangedCallback(). r?smaug
This was found by -Wmisleading-indentation:
> nsJSEnvironment.cpp: In function ‘void SetMemoryGCSliceTimePrefChangedCallback(const char*, void*)’:
> nsJSEnvironment.cpp:2329:3: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
> if (pref > 0 && pref < 100000)
> ^~
> nsJSEnvironment.cpp:2331:5: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
> JS_SetGCParameter(sContext, JSGC_SLICE_TIME_BUDGET, pref);
MozReview-Commit-ID: HWpQatZvdqe
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -2321,19 +2321,20 @@ SetMemoryGCModePrefChangedCallback(const
JS_SetGCParameter(sContext, JSGC_MODE, mode);
}
static void
SetMemoryGCSliceTimePrefChangedCallback(const char* aPrefName, void* aClosure)
{
int32_t pref = Preferences::GetInt(aPrefName, -1);
// handle overflow and negative pref values
- if (pref > 0 && pref < 100000)
+ if (pref > 0 && pref < 100000) {
sActiveIntersliceGCBudget = pref;
JS_SetGCParameter(sContext, JSGC_SLICE_TIME_BUDGET, pref);
+ }
}
static void
SetMemoryGCCompactingPrefChangedCallback(const char* aPrefName, void* aClosure)
{
bool pref = Preferences::GetBool(aPrefName);
JS_SetGCParameter(sContext, JSGC_COMPACTING_ENABLED, pref);
}