Rename the memory allocating versions to make prev error less likely

The behavior is different enough that these shouldn't be overloaded
with the non-allocating verions. Also makes it more obvious what is
going on to the caller.
This commit is contained in:
Ben Payne 2015-01-23 16:09:01 -05:00
parent d669eb6ee7
commit fcf52fb5e0
9 changed files with 17 additions and 17 deletions

View file

@ -346,7 +346,7 @@ class String::StringData : protected StringDataImpl
{
// Do this atomically to protect interned strings.
UTF16* utf16 = convertUTF8toUTF16( mData );
UTF16* utf16 = createUTF16string( mData );
if( !dCompareAndSwap( mUTF16,( UTF16* ) NULL, utf16 ) )
delete [] utf16;
}
@ -580,7 +580,7 @@ String::String(const UTF16 *str)
if( str && str[ 0 ] )
{
UTF8* utf8 = convertUTF16toUTF8( str );
UTF8* utf8 = createUTF8string( str );
U32 len = dStrlen( utf8 );
_string = new ( len ) StringData( utf8 );
delete [] utf8;

View file

@ -44,7 +44,7 @@ protected:
: mData( str ), mLength( str ? dStrlen( str ) : 0 ), mUTF16( NULL )
{
if( str )
mUTF16 = convertUTF8toUTF16( mData );
mUTF16 = createUTF16string( mData );
}
~StrTest()
{