On Fri, Aug 31, 2018 at 8:43 AM, Henri Sivonen <hsivo...@mozilla.com> wrote: > At this point, it's probably relevant to mention that SetCapacity() in > situations other that ahead of a sequence of Append()s is most likely > wrong (and has been so since at least 2004; I didn't bother doing code > archeology further back than that).
I wrote some SetCapacity() docs at: https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Guide/Internal_strings#Sequence_of_appends_without_reallocating (I caused SetLength, AppendUTF16toUTF8 and AppendUTF8toUTF16 to move from the first list to the second, but, other than that, XPCOM strings have been this way long before I took a look at this code and I'm just the messenger here.) Also filed a static analysis request for this: https://bugzilla.mozilla.org/show_bug.cgi?id=1487612 -- Henri Sivonen hsivo...@mozilla.com _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform