Use clear() instread of erase(begin(), end()). (PR #1053)

This commit is contained in:
Kelvin Lee 2022-03-12 22:19:34 +11:00 committed by GitHub
parent 51149083e6
commit be846efc83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 12 deletions

View File

@ -2906,9 +2906,8 @@ Update_t CmdCursorLineUp (int nArgs)
static std::vector<LookAhead_t> aTopCandidates;
LookAhead_t tCandidate;
// if (! aBestTop.capacity() )
aTopCandidates.clear();
aTopCandidates.reserve( MAX_LOOK_AHEAD );
aTopCandidates.erase( aTopCandidates.begin(), aTopCandidates.end() );
WORD nTop = g_nDisasmTopAddress;
WORD iTop = 0;
@ -5316,8 +5315,9 @@ int _SearchMemoryFind(
WORD nAddressStart,
WORD nAddressEnd )
{
int nFound = 0;
g_vMemorySearchResults.erase( g_vMemorySearchResults.begin(), g_vMemorySearchResults.end() );
int nFound = 0;
g_vMemorySearchResults.clear();
g_vMemorySearchResults.push_back( NO_6502_TARGET );
WORD nAddress;
@ -5614,7 +5614,7 @@ Update_t _CmdMemorySearch (int nArgs, bool bTextIsAscii = true )
// must be numeric .. make sure not too big
if (pArg->nArgLen > 2)
{
vMemorySearchValues.erase( vMemorySearchValues.begin(), vMemorySearchValues.end() );
vMemorySearchValues.clear();
return HelpLastCommand();
}
@ -5661,7 +5661,7 @@ Update_t _CmdMemorySearch (int nArgs, bool bTextIsAscii = true )
}
_SearchMemoryFind( vMemorySearchValues, nAddressStart, nAddressEnd );
vMemorySearchValues.erase( vMemorySearchValues.begin(), vMemorySearchValues.end() );
vMemorySearchValues.clear();
return _SearchMemoryDisplay();
}
@ -7411,7 +7411,7 @@ int FindParam(LPCTSTR pLookupName, Match_e eMatch, int & iParam_, int iParamBegi
//===========================================================================
int FindCommand( LPCTSTR pName, CmdFuncPtr_t & pFunction_, int * iCommand_ )
{
g_vPotentialCommands.erase( g_vPotentialCommands.begin(), g_vPotentialCommands.end() );
g_vPotentialCommands.clear();
int nFound = 0;
int nLen = _tcslen( pName );
@ -7450,7 +7450,7 @@ int FindCommand( LPCTSTR pName, CmdFuncPtr_t & pFunction_, int * iCommand_ )
// *iCommand_ = iCommand;
nFound = 1; // Exact match takes precidence over fuzzy matches
g_vPotentialCommands.erase( g_vPotentialCommands.begin(), g_vPotentialCommands.end() );
g_vPotentialCommands.clear();
break;
}
}
@ -8513,7 +8513,7 @@ static void DebugEnd ()
g_hTraceFile = NULL;
}
g_vMemorySearchResults.erase( g_vMemorySearchResults.begin(), g_vMemorySearchResults.end() );
g_vMemorySearchResults.clear();
g_nAppMode = MODE_RUNNING;

View File

@ -79,7 +79,7 @@ void MemoryTextFile_t::GetLinePointers()
if (! m_bDirty)
return;
m_vLines.erase( m_vLines.begin(), m_vLines.end() );
m_vLines.clear();
char *pBegin = & m_vBuffer[ 0 ];
char *pLast = & m_vBuffer[ m_vBuffer.size()-1 ];

View File

@ -24,8 +24,8 @@
bool Read( const std::string & pFileName );
void Reset()
{
m_vBuffer.erase( m_vBuffer.begin(), m_vBuffer.end() );
m_vLines.erase( m_vLines.begin(), m_vLines.end() );
m_vBuffer.clear();
m_vLines.clear();
}
inline int GetNumLines()