Closed Bug 1438615 Opened 6 years ago Closed 6 years ago

nsIToolkitProfileService.profileCount should return the number of profiles

Categories

(Toolkit :: Startup and Profile System, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla60
Tracking Status
firefox60 --- fixed

People

(Reporter: mossop, Assigned: mossop)

Details

Attachments

(1 file)

This bizarre API is just asking for confusion. Let's make it sane.
Comment on attachment 8951363 [details]
Bug 1438615: profileCount should actually return the number of profiles.

https://reviewboard.mozilla.org/r/220620/#review227458

::: toolkit/profile/nsToolkitProfileService.cpp:960
(Diff revision 1)
>  NS_IMETHODIMP
>  nsToolkitProfileService::GetProfileCount(uint32_t *aResult)
>  {
> -    if (!mFirst)
> -        *aResult = 0;
> +    *aResult = 0;
> -    else if (! mFirst->mNext)
> +    nsToolkitProfile* profile = mFirst.get();

Why do you need the .get() calls here?

A few lines later there's the same code implemented as simply:

    for (cur = mFirst; cur != nullptr; cur = cur->mNext)
        ++pCount;
Comment on attachment 8951363 [details]
Bug 1438615: profileCount should actually return the number of profiles.

https://reviewboard.mozilla.org/r/220620/#review227458

> Why do you need the .get() calls here?
> 
> A few lines later there's the same code implemented as simply:
> 
>     for (cur = mFirst; cur != nullptr; cur = cur->mNext)
>         ++pCount;

Can't remember why I did that. Seems to work fine without it. Updated the patch.
Comment on attachment 8951363 [details]
Bug 1438615: profileCount should actually return the number of profiles.

https://reviewboard.mozilla.org/r/220620/#review227574
Attachment #8951363 - Flags: review?(florian) → review+
Pushed by dtownsend@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c4420500cda8
profileCount should actually return the number of profiles. r=florian
https://hg.mozilla.org/mozilla-central/rev/c4420500cda8
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: