chore: remove unused name parameter from ARCH->daemonize

This commit is contained in:
sithlord48 2025-10-07 16:55:28 -04:00 committed by Nick Bolton
parent aae3067f03
commit 04b3f5c769
9 changed files with 11 additions and 17 deletions

View file

@ -12,12 +12,10 @@
// ArchDaemonNone // ArchDaemonNone
// //
int ArchDaemonNone::daemonize(const QString &name, DaemonFunc const &func) int ArchDaemonNone::daemonize(DaemonFunc const &func)
{ {
// simply forward the call to func. obviously, this doesn't // simply forward the call to func. obviously, this doesn't
// do any daemonizing. // do any daemonizing.
auto t = name.toStdString();
const char *n = t.c_str();
return func(); return func();
} }

View file

@ -24,6 +24,6 @@ public:
~ArchDaemonNone() override = default; ~ArchDaemonNone() override = default;
// IArchDaemon overrides // IArchDaemon overrides
int daemonize(const QString &name, DaemonFunc const &func) override; int daemonize(DaemonFunc const &func) override;
QString commandLine() const override; QString commandLine() const override;
}; };

View file

@ -53,7 +53,7 @@ public:
\c ArchMiscWindows::daemonFailed() to indicate startup failure. \c ArchMiscWindows::daemonFailed() to indicate startup failure.
</ul> </ul>
*/ */
virtual int daemonize(const QString &name, DaemonFunc const &func) = 0; virtual int daemonize(DaemonFunc const &func) = 0;
//@} //@}

View file

@ -47,12 +47,10 @@ bool alreadyDaemonized()
#endif #endif
int ArchDaemonUnix::daemonize(const QString &name, DaemonFunc const &func) int ArchDaemonUnix::daemonize(DaemonFunc const &func)
{ {
#ifdef __APPLE__ #ifdef __APPLE__
if (alreadyDaemonized()) { if (alreadyDaemonized()) {
auto t = name.toStdString();
const char *n = t.c_str();
return func(); return func();
} }
#endif #endif
@ -108,8 +106,5 @@ int ArchDaemonUnix::daemonize(const QString &name, DaemonFunc const &func)
#endif #endif
// invoke function // invoke function
auto t = name.toStdString();
const char *n = t.c_str();
return func(); return func();
} }

View file

@ -20,5 +20,5 @@ public:
~ArchDaemonUnix() override = default; ~ArchDaemonUnix() override = default;
// IArchDaemon overrides // IArchDaemon overrides
int daemonize(const QString &name, DaemonFunc const &func) override; int daemonize(DaemonFunc const &func) override;
}; };

View file

@ -12,6 +12,7 @@
#include "arch/win32/ArchMiscWindows.h" #include "arch/win32/ArchMiscWindows.h"
#include "arch/win32/XArchWindows.h" #include "arch/win32/XArchWindows.h"
#include "base/Log.h" #include "base/Log.h"
#include "common/Constants.h"
// //
// ArchDaemonWindows // ArchDaemonWindows
@ -52,7 +53,7 @@ void ArchDaemonWindows::daemonFailed(int result)
throw ArchDaemonRunException(result); throw ArchDaemonRunException(result);
} }
int ArchDaemonWindows::daemonize(const QString &name, DaemonFunc const &func) int ArchDaemonWindows::daemonize(DaemonFunc const &func)
{ {
assert(name != nullptr); assert(name != nullptr);
assert(func != nullptr); assert(func != nullptr);
@ -62,7 +63,7 @@ int ArchDaemonWindows::daemonize(const QString &name, DaemonFunc const &func)
// construct the service entry // construct the service entry
SERVICE_TABLE_ENTRY entry[2]; SERVICE_TABLE_ENTRY entry[2];
entry[0].lpServiceName = const_cast<wchar_t *>(name.toStdWString().c_str()); entry[0].lpServiceName = const_cast<wchar_t *>(QString(kAppName).toStdWString().c_str());
entry[0].lpServiceProc = &ArchDaemonWindows::serviceMainEntry; entry[0].lpServiceProc = &ArchDaemonWindows::serviceMainEntry;
entry[1].lpServiceName = nullptr; entry[1].lpServiceName = nullptr;
entry[1].lpServiceProc = nullptr; entry[1].lpServiceProc = nullptr;

View file

@ -68,7 +68,7 @@ public:
static UINT getDaemonQuitMessage(); static UINT getDaemonQuitMessage();
// IArchDaemon overrides // IArchDaemon overrides
int daemonize(const QString &name, DaemonFunc const &func) override; int daemonize(DaemonFunc const &func) override;
QString commandLine() const override QString commandLine() const override
{ {
return m_commandLine; return m_commandLine;

View file

@ -138,7 +138,7 @@ void DaemonApp::run(QThread &daemonThread)
mainLoop(); mainLoop();
} else { } else {
LOG_DEBUG("running daemon in background (daemonizing)"); LOG_DEBUG("running daemon in background (daemonizing)");
ARCH->daemonize(kAppName, [this] { return daemonLoop(); }); ARCH->daemonize([this] { return daemonLoop(); });
} }
daemonThread.quit(); daemonThread.quit();

View file

@ -89,7 +89,7 @@ int AppUtilWindows::daemonNTStartup()
{ {
SystemLogger sysLogger(app().daemonName(), false); SystemLogger sysLogger(app().daemonName(), false);
m_exitMode = kExitModeDaemon; m_exitMode = kExitModeDaemon;
return ARCH->daemonize(app().daemonName(), daemonNTMainLoopStatic); return ARCH->daemonize(daemonNTMainLoopStatic);
} }
static int daemonNTStartupStatic() static int daemonNTStartupStatic()