On Fri, 12 Oct 2001 10:44:37 -0400, Mike Shaver <[EMAIL PROTECTED]> wrote: >Jon Smirl wrote: > >> What is the current coding style rule for functions like these, should they >> even exist? Since they avoid CreateInstance they make it impossible to swap >> out their associated component. > >Ask in .netlib, I guess. And ask the people who are calling them.
They're just helper wrappers for common operations. NS_NewURI just calls nsIIOService::NewURI, while NS_OpenURI calls the ioservice too, and calls the associated setters on the new channel. They're marked inline, but if the compiler can't inline it it will make a copy. This isn't bloat, since if that file wasn't there, then the callers would have to duplicate the code anyway. Theres also no lack of componant swapability from the inlining - since these functions use only the public API, they will only break if that changes, and then callers would have been in trouble anyway. > >do_CreateInstance isn't always what you want. If you're not set up to >allow arbitrary implementations of the component (taking into account >threadsafety and other issues that come with that), you should probably >just use |new| and save the cycles. > Unlike the layout/content NS_New* functions, I don't think any of these call private methods on the actual object. >Mike > Bradley
