Trim address entry field.

Sometimes a stray whitespace may be inserted in the address field, for
example when copying and pasting from somewhere else.
This commit is contained in:
Bartosz Taudul
2024-09-09 20:41:28 +02:00
parent 5795bc5766
commit d46eebf794
3 changed files with 25 additions and 17 deletions

View File

@@ -65,17 +65,16 @@ void ConnectionHistory::Rebuild()
std::swap( m_connHistVec, vec );
}
void ConnectionHistory::Count( const char* name )
void ConnectionHistory::Count( const std::string& name )
{
std::string addr( name );
auto it = m_connHistMap.find( addr );
auto it = m_connHistMap.find( name );
if( it != m_connHistMap.end() )
{
it->second++;
}
else
{
m_connHistMap.emplace( std::move( addr ), 1 );
m_connHistMap.emplace( name, 1 );
}
Rebuild();
}