Skip to content

Commit

Permalink
tools/cli/sortincludes: some small improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasdr committed Nov 17, 2023
1 parent 8012766 commit 4774f0e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/tdme/tools/cli/sortincludes-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void scanDir(const string& folder, vector<string>& totalFiles) {
}
}

static int string_compare(const string& lhs, const string& rhs) {
static int compare_includes(const string& lhs, const string& rhs) {
if (StringTools::startsWith(lhs, "#include <tdme/tdme.h>") == true) return true; else
if (StringTools::startsWith(rhs, "#include <tdme/tdme.h>") == true) return false;
auto charCount = Math::min((int32_t)lhs.size(), (int32_t)rhs.size());
Expand Down Expand Up @@ -116,7 +116,7 @@ void parseHpp(const string& fileName) {
if (hadTDMEHInclude == false) hadTDMEHInclude = StringTools::trim(line) == "#include <tdme/tdme.h>";
} else
if (startLineIdx != -1 && endLineIdx != -1) {
sort(newFileContent.begin() + startLineIdx, newFileContent.begin() + endLineIdx + 1, string_compare);
sort(newFileContent.begin() + startLineIdx, newFileContent.begin() + endLineIdx + 1, compare_includes);
startLineIdx = -1;
endLineIdx = -1;
}
Expand Down Expand Up @@ -150,7 +150,7 @@ void parseHpp(const string& fileName) {
}
} else
if (startLineIdx != -1 && endLineIdx != -1) {
sort(newFileContent.begin() + startLineIdx, newFileContent.begin() + endLineIdx + 1, string_compare);
sort(newFileContent.begin() + startLineIdx, newFileContent.begin() + endLineIdx + 1, compare_includes);
startLineIdx = -1;
endLineIdx = -1;
}
Expand Down

0 comments on commit 4774f0e

Please sign in to comment.