Closed Bug 1413085 Opened 7 years ago Closed 7 years ago

Make PREF_Get{CString,Int,Bool}Pref() more uniform

Categories

(Core :: Preferences: Backend, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox58 --- fixed

People

(Reporter: n.nethercote, Assigned: n.nethercote)

References

Details

Attachments

(2 files)

No description provided.
Comment on attachment 8923677 [details] Bug 1413085 - Make PREF_Get{CString,Int,Bool}Pref() more uniform. . https://reviewboard.mozilla.org/r/194802/#review199898 Should GetIntPref and GetBoolPref reset aValueOut on error?
Attachment #8923677 - Flags: review?(mh+mozilla) → review+
Comment on attachment 8923680 [details] Bug 1413085 - Inline and remove pref_SetPref(). . https://reviewboard.mozilla.org/r/194804/#review199900 ::: modules/libpref/Preferences.cpp:4104 (Diff revision 1) > + rv = SetPrefValue(prefName, defaultValue.get_PrefValue(), DEFAULT_VALUE); > + if (NS_FAILED(rv)) { you could do `if (NS_FAILED(SetPrefValue(...))` and not have rv at all. If you still prefer to have rv = ... ; if (NS_FAILED(rv)), at least move the variable declaration here.
Attachment #8923680 - Flags: review?(mh+mozilla) → review+
> Should GetIntPref and GetBoolPref reset aValueOut on error? They don't currently, so I'll leave them unchanged. Assuming anything about outparams on failure is a bad idea. Some GetStringPref() do that, unfortunately, and the Voiding is required. I will probably add some MOZ_MUST_USE and [must_use] annotations to fix up these uses.
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: