changeset 5023:c8c98389080f

use constant for multiply occurring string
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 17 Jun 2022 07:23:57 +0200
parents 3d0a084e1ace
children 06ffe03d008a
files OrthancServer/Sources/LuaScripting.cpp
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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 <OrthancServerResources.h>
 
+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);