size_t CScriptKeyAlloc::ParseKeyEnd() { ADDTOCALLSTACK("CScriptKeyAlloc::ParseKeyEnd"); // Now parse the line for comments and trailing whitespace junk // NOTE: leave leading whitespace for now. ASSERT(m_pszKey); size_t len = 0; for ( ; len < SCRIPT_MAX_LINE_LEN; len++ ) { TCHAR ch = m_pszKey[len]; if ( ch == '\0' ) break; if ( ch == '/' && m_pszKey[len + 1] == '/' ) { // Remove comment at end of line. break; } } // Remove CR and LF from the end of the line. len = Str_TrimEndWhitespace( m_pszKey, len ); if ( len <= 0 ) // fRemoveBlanks && return 0; m_pszKey[len] = '\0'; return( len ); }
TCHAR * Str_TrimWhitespace( TCHAR * pStr ) { GETNONWHITESPACE( pStr ); Str_TrimEndWhitespace( pStr, strlen(pStr)); return( pStr ); }