Skip to content

Commit

Permalink
Slightly improve macro lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
mungre committed Jun 2, 2024
1 parent c8717f5 commit 0a0c3cb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/macro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ void MacroTable::Add( Macro* macro )
/*************************************************************************************************/
bool MacroTable::Exists( const string& name ) const
{
return ( m_map.count( name ) > 0 );
return m_map.find( name ) != m_map.cend();
}


Expand All @@ -230,9 +230,10 @@ bool MacroTable::Exists( const string& name ) const
/*************************************************************************************************/
const Macro* MacroTable::Get( const string& name ) const
{
if ( Exists( name ) )
map<string, Macro*>::const_iterator it = m_map.find( name );
if (it != m_map.cend())
{
return m_map.find( name )->second;
return it->second;
}
else
{
Expand Down

0 comments on commit 0a0c3cb

Please sign in to comment.