Prefer TrimPrefix() over Left() + LeftChomp()

This commit is contained in:
J-P Nurmi
2015-08-14 12:29:42 +02:00
parent 2d5aa8da59
commit 475acd8f00
5 changed files with 7 additions and 16 deletions

View File

@@ -107,9 +107,7 @@ bool CConfig::Parse(CFile& file, CString& sErrorMsg)
sTag.Trim();
sValue.Trim();
if (sTag.Left(1) == "/") {
sTag = sTag.substr(1);
if (sTag.TrimPrefix("/")) {
if (!sValue.empty())
ERROR("Malformated closing tag. Expected \"</" << sTag << ">\".");
if (ConfigStack.empty())
@@ -153,8 +151,7 @@ bool CConfig::Parse(CFile& file, CString& sErrorMsg)
// Only remove the first space, people might want
// leading spaces (e.g. in the MOTD).
if (sValue.Left(1) == " ")
sValue.LeftChomp();
sValue.TrimPrefix(" ");
// We don't have any names with spaces, trim all
// leading/trailing spaces.