chore(daemon): Make function const and better string compare

- Make `clearSettings` const in daemon app
- Improve readability of empty command check
This commit is contained in:
Nick Bolton 2025-03-04 11:34:50 +00:00
parent 5ee39c9b00
commit 2c433eddd7
2 changed files with 3 additions and 3 deletions

View file

@ -135,7 +135,7 @@ void DaemonApp::clearWatchdogCommand()
#endif #endif
} }
void DaemonApp::clearSettings() void DaemonApp::clearSettings() const
{ {
LOG_INFO("clearing daemon settings"); LOG_INFO("clearing daemon settings");
ARCH->clearSettings(); ARCH->clearSettings();
@ -228,7 +228,7 @@ void DaemonApp::mainLoop()
std::string command = ARCH->setting("Command"); std::string command = ARCH->setting("Command");
bool elevate = ARCH->setting("Elevate") == "1"; bool elevate = ARCH->setting("Elevate") == "1";
if (command != "") { if (!command.empty()) {
LOG_DEBUG("using last known command: %s", command.c_str()); LOG_DEBUG("using last known command: %s", command.c_str());
m_watchdog->setProcessConfig(command, elevate); m_watchdog->setProcessConfig(command, elevate);
} }

View file

@ -52,7 +52,7 @@ public:
void setCommand(const QString &command); void setCommand(const QString &command);
void applyWatchdogCommand() const; void applyWatchdogCommand() const;
void clearWatchdogCommand(); void clearWatchdogCommand();
void clearSettings(); void clearSettings() const;
std::string logFilename(); std::string logFilename();
static DaemonApp &instance() static DaemonApp &instance()