Closed Bug 86734 Opened 23 years ago Closed 23 years ago

Code cleanup for NS_WITH_SERVICE()

Categories

(MailNews Core :: Backend, defect)

All
Windows NT
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: cavin, Assigned: jag+mozilla)

Details

Attachments

(2 files)

Just a reminder for code cleanup.

Shouldn't be adding code that uses NS_WITH_SERVICE(). So instead of using:

static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);

NS_WITH_SERVICE(nsIStringBundleService, sBundleService, kStringBundleServiceCID, 
&rv); 

Use the following instead:

nsCOMPtr<nsIStringBundleService> sBundleService =  
do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);

Notice that there is no static CID here. The same goes for 
NS_WITH_SERVICE(nsIPref, prefs, kPrefServiceCID, &rv);

A lot of mailnews files have this problem.
Reassign to myself.
Assignee: mscott → cavin
Summary: Code clean up for NS_WITH_SERVICE() → Code cleanup for NS_WITH_SERVICE()
Oh yeah, I've been waiting for something like this.
FYI, this isn't too big a deal Cavin, and I would treat this with a very low
priority. Using the NS_WITH_SERVICE macros doesn't break anything and we've got
more important fish to fry right now than to go through and change a bunch of
old callers over.....
Taking this bug, patch coming up.
Assignee: cavin → jaggernaut
rs=scc
Filed bugscape bug 7887 for the Netscape side of this.

Updated patch coming up.
r=dbaron (trusting the perl script, after looking at some nice examples where it
handled all sorts of things correctly)

You probably shouldn't check in nsIServiceManager.h before midnight due to the
closure, and you should definitely post to n.p.m.{seamonkey,xpcom}, and may want
to wait a bit after that although probably not.
QA Contact: esther → stephend
Checked in.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
verified fixed via code verification (LXR)
Status: RESOLVED → VERIFIED
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: