Jon Smirl wrote:
> ------- Additional Comments From [EMAIL PROTECTED] 2001-09-10 23:31
> > I also see that in a lot of places you have converted nsString& parameters
> > to nsAString& parameters. While this is laudable, is it what we really want?
> > In some cases we might want nsAFlatString& for performance reasons (where we
> > know the string will be flat, i.e. single fragment, zero-terminated, and
> > most or all usage of that code will be from flat strings, and we can hand
> > flatten the few non flat strings).
>
> Should the XPIDL AString be AFlatString instead? Are there really cases in
> the Mozilla code where you want to send AString's across an XPCOM interface?
No, in XPIDL we should be using nsAString for flexibility, since this allows
you to pass around things like concatenations of string (e.g. a + b) without
necessarily having to copy. Where you need flat strings (generally when
dealing with systems outside Mozilla, e.g. other programs or the OS) you can
use PromiseFlatString(someAString).get(). PromiseFlatString is very cheap for
strings that are already flat, and have the cost of a string copy for strings
which are not.
In that comment I was wondering how much thought you had given to the changes
you made. Were they glue changes to make the code work with the new interface?
Did you look further down to see if there were additional benefits to be
gained from your changes?
jag