mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-02 21:52:32 -06:00
Utilize algorithms from std::ranges
The result is shorter code and improves readability. Note that `asConst()` is still required for non-const containers, otherwise the container will detach. PR #23342.
This commit is contained in:
@@ -87,7 +87,7 @@ namespace
|
||||
void normalExitHandler(const int signum)
|
||||
{
|
||||
const char *msgs[] = {"Catching signal: ", sysSigName[signum], "\nExiting cleanly\n"};
|
||||
std::for_each(std::begin(msgs), std::end(msgs), safePrint);
|
||||
std::ranges::for_each(msgs, safePrint);
|
||||
signal(signum, SIG_DFL);
|
||||
QMetaObject::invokeMethod(qApp, [] { QCoreApplication::exit(); }, Qt::QueuedConnection); // unsafe, but exit anyway
|
||||
}
|
||||
@@ -103,7 +103,7 @@ namespace
|
||||
const std::string stacktrace = getStacktrace();
|
||||
|
||||
const char *msgs[] = {msg, sigName, "\n```\n", stacktrace.c_str(), "```\n\n"};
|
||||
std::for_each(std::begin(msgs), std::end(msgs), safePrint);
|
||||
std::ranges::for_each(msgs, safePrint);
|
||||
|
||||
#ifndef DISABLE_GUI
|
||||
StacktraceDialog dlg; // unsafe
|
||||
|
||||
Reference in New Issue
Block a user