# HG changeset patch # User Sebastien Jodogne # Date 1655443437 -7200 # Node ID c8c98389080ff21fe4d7c1cc7cebbbd3b82a3142 # Parent 3d0a084e1ace6f1e18b1e9ec98c086c735196f81 use constant for multiply occurring string diff -r 3d0a084e1ace -r c8c98389080f OrthancServer/Sources/LuaScripting.cpp --- a/OrthancServer/Sources/LuaScripting.cpp Fri Jun 17 07:20:19 2022 +0200 +++ b/OrthancServer/Sources/LuaScripting.cpp Fri Jun 17 07:23:57 2022 +0200 @@ -34,6 +34,8 @@ #include +static const char* ON_HEART_BEAT = "OnHeartBeat"; + namespace Orthanc { @@ -803,9 +805,9 @@ { LuaScripting::Lock lock(*that); - if (lock.GetLua().IsExistingFunction("OnHeartBeat")) + if (lock.GetLua().IsExistingFunction(ON_HEART_BEAT)) { - LuaFunctionCall call(lock.GetLua(), "OnHeartBeat"); + LuaFunctionCall call(lock.GetLua(), ON_HEART_BEAT); call.Execute(); } @@ -868,7 +870,7 @@ LuaScripting::Lock lock(*this); - if (heartBeatPeriod_ > 0 && lock.GetLua().IsExistingFunction("OnHeartBeat")) + if (heartBeatPeriod_ > 0 && lock.GetLua().IsExistingFunction(ON_HEART_BEAT)) { LOG(INFO) << "Starting the Lua HeartBeat thread with a period of " << heartBeatPeriod_ << " seconds"; heartBeatThread_ = boost::thread(HeartBeatThread, this);