String literals, ASCII vs UTF-8
Lubos Lunak
l.lunak at suse.cz
Tue Feb 28 05:48:28 PST 2012
On Tuesday 28 of February 2012, Michael Meeks wrote:
> I would really prefer to use a new:
>
> rtl_uString_newFromAsciiL( &pNew, literal, N - 1 );
Attached.
> method - which should shrink the call-site, and allow for a rather
> better implementation vs.
Speaking of the size at the call-site, I good part is the code trying to
throw std::bad_alloc in case the allocation fails. That actually looks rather
useless to me, for several reasons:
- not all OUString methods check for this anyway
- rtl_uString* functions do OSL_ASSERT() after allocations
- with today's systems (overcommitting, etc.) it is rather pointless to guard
against allocation failures
Does somebody see a good reason not to just remove it?
--
Lubos Lunak
l.lunak at suse.cz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-rtl_uString_newFromAscii_WithLength-and-use-it-in-OU.patch
Type: text/x-diff
Size: 3769 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20120228/0b5c7530/attachment-0002.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-remove-std-bad_alloc-throwing-in-some-OUString-funct.patch
Type: text/x-diff
Size: 4521 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20120228/0b5c7530/attachment-0003.patch>
More information about the LibreOffice
mailing list