refactor: IKeyState: directly make string when spilting as arg to emplace

This commit is contained in:
sithlord48
2025-08-04 10:21:54 -04:00
committed by Nick Bolton
parent 048ce47008
commit 3b2b8a9ebe
2 changed files with 8 additions and 10 deletions

View File

@ -134,7 +134,7 @@ void IKeyState::KeyInfo::split(const char *screens, std::set<std::string> &dst)
const char *i = screens + 1;
while (*i != '\0') {
const char *j = strchr(i, ':');
dst.emplace(std::string(i, j - i));
dst.emplace(i, j - i);
i = j + 1;
}
}

View File

@ -247,15 +247,13 @@ QTextStream &operator<<(QTextStream &outStream, const ServerConfig &config)
outStream << "section: links" << Qt::endl;
for (int i = 0; const auto &screen : config.screens()) {
if (screen.isNull()) {
i++;
continue;
}
outStream << "\t" << screen.name() << ":\n";
for (const auto &neighbour : std::as_const(neighbourDirs)) {
int idx = config.adjacentScreenIndex(i, neighbour.x, neighbour.y);
if (idx != -1 && !config.screens()[idx].isNull())
outStream << "\t\t" << neighbour.name << " = " << config.screens()[idx].name() << Qt::endl;
if (!screen.isNull()) {
outStream << "\t" << screen.name() << ":\n";
for (const auto &neighbour : std::as_const(neighbourDirs)) {
int idx = config.adjacentScreenIndex(i, neighbour.x, neighbour.y);
if (idx != -1 && !config.screens()[idx].isNull())
outStream << "\t\t" << neighbour.name << " = " << config.screens()[idx].name() << Qt::endl;
}
}
i++;
}