Checking string allocations (was Re: String literals, ASCII vs UTF-8)

Caolán McNamara caolanm at redhat.com
Fri Mar 2 09:16:21 PST 2012


On Fri, 2012-03-02 at 16:00 +0100, Stephan Bergmann wrote:
> And when/if we replace the sal C API with a C++ one in LO 4 (where a 
> memory allocation function, if we would still need a home-grown one 
> anyway, would naturally throw bad_alloc)

Yeah, back the O[UString contents with direct new/delete calls in a real
implementation body instead of current thin header-only wrapper around
the C-API which backs onto rtl_allocateMemory/rtl_freeMemory.

Alternative, replace rtl_allocateMemory/rtl_freeMemory in strtmpl.cxx
with new/delete, and remove the inline bad_alloc throwing from the
header and assume that there isn't any existing users of the c-api that
ever checked that rtl_uString2String failed

C.



More information about the LibreOffice mailing list