Instead of adding new method, make StoreString public

This commit is contained in:
Tiago Rodrigues 2023-11-18 15:04:02 -05:00 committed by trodrigues
parent c302b509fe
commit 687d681764
2 changed files with 1 additions and 15 deletions

View File

@ -2426,19 +2426,6 @@ const char* Worker::GetString( const StringIdx& idx ) const
return m_data.stringData[idx.Idx()]; return m_data.stringData[idx.Idx()];
} }
uint32_t Worker::AddNewString(const char* newString)
{
assert(m_allowStringModification);
uint64_t sz = strlen(newString);
auto ptr = m_slab.Alloc<char>( sz+1 );
memcpy( ptr, newString, sz );
ptr[sz] = '\0';
uint32_t idx = m_data.stringData.size();
m_data.stringMap.emplace( charutil::StringKey { ptr, sz }, idx );
m_data.stringData.push_back( ptr );
return idx;
}
static const char* BadExternalThreadNames[] = { static const char* BadExternalThreadNames[] = {
"ntdll.dll", "ntdll.dll",
"???", "???",

View File

@ -667,7 +667,7 @@ public:
void CacheSourceFiles(); void CacheSourceFiles();
uint32_t AddNewString(const char* newString); StringLocation StoreString(const char* str, size_t sz);
private: private:
void Network(); void Network();
@ -896,7 +896,6 @@ private:
uint32_t GetSingleStringIdx(); uint32_t GetSingleStringIdx();
uint32_t GetSecondStringIdx(); uint32_t GetSecondStringIdx();
StringLocation StoreString( const char* str, size_t sz );
const ContextSwitch* const GetContextSwitchDataImpl( uint64_t thread ); const ContextSwitch* const GetContextSwitchDataImpl( uint64_t thread );
void CacheSource( const StringRef& str, const StringIdx& image = StringIdx() ); void CacheSource( const StringRef& str, const StringIdx& image = StringIdx() );