From 6dc474d41b30c59ac3c09a658c220d813ffbc13f Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Thu, 27 Oct 2005 06:11:59 +0000 Subject: [PATCH] don't make a copy of the string when comparing --- stepmania/src/RageUtil.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/stepmania/src/RageUtil.cpp b/stepmania/src/RageUtil.cpp index d7fe33ade4..81ab84daf8 100644 --- a/stepmania/src/RageUtil.cpp +++ b/stepmania/src/RageUtil.cpp @@ -664,19 +664,15 @@ void StripCrnl(CString &s) bool BeginsWith( const CString &sTestThis, const CString &sBeginning ) { ASSERT( !sBeginning.empty() ); - - if( sTestThis.size() < sBeginning.size() ) - return false; - return sTestThis.Left( sBeginning.size() ) == sBeginning; + return sTestThis.compare( 0, sBeginning.length(), sBeginning ) == 0; } bool EndsWith( const CString &sTestThis, const CString &sEnding ) { ASSERT( !sEnding.empty() ); - if( sTestThis.size() < sEnding.size() ) return false; - return sTestThis.Right( sEnding.size() ) == sEnding; + return sTestThis.compare( sTestThis.length()-sEnding.length(), sEnding.length(), sEnding ) == 0; } void StripCvs( vector &vs )