No need to inject string terminator.

Comparison in m_data.stringMap already takes string size into account,
as an charutil::StringKey optimization.
This commit is contained in:
Bartosz Taudul 2019-11-07 01:28:29 +01:00
parent dfad9695d2
commit 4a4fe82a1b

View File

@ -3345,8 +3345,6 @@ void Worker::HandlePostponedPlots()
StringLocation Worker::StoreString( char* str, size_t sz )
{
StringLocation ret;
const char backup = str[sz];
str[sz] = '\0';
charutil::StringKey key = { str, sz };
auto sit = m_data.stringMap.find( key );
if( sit == m_data.stringMap.end() )
@ -3364,7 +3362,6 @@ StringLocation Worker::StoreString( char* str, size_t sz )
ret.ptr = sit->first.ptr;
ret.idx = sit->second;
}
str[sz] = backup;
return ret;
}