From 11bc9aa893e5e9af8394943156b79c320b1ff840 Mon Sep 17 00:00:00 2001 From: kochalas <konstantinos.chalas@cern.ch> Date: Fri, 8 Sep 2017 11:11:48 +0200 Subject: [PATCH] [SIL-317] Declare a local 'area = theBlock_->getAccessArea()' on top and use this one everywhere. --- .../silecs-communication/interface/core/PLCRecvAction.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/silecs-communication-cpp/src/silecs-communication/interface/core/PLCRecvAction.cpp b/silecs-communication-cpp/src/silecs-communication/interface/core/PLCRecvAction.cpp index 9dae94d..92230bc 100644 --- a/silecs-communication-cpp/src/silecs-communication/interface/core/PLCRecvAction.cpp +++ b/silecs-communication-cpp/src/silecs-communication/interface/core/PLCRecvAction.cpp @@ -59,6 +59,7 @@ int PLCRecvBlockMode::execute(Context* pContext) int errorCode = 0; Connection* pConn = theBlock_->getPLC()->getConnection(); + AccessArea area = theBlock_->getAccessArea(); try { @@ -69,7 +70,6 @@ int PLCRecvBlockMode::execute(Context* pContext) Device* pDev = pContext->getDevice(); //Base attributes of the device within the complete data block containing all devices. - AccessArea area = theBlock_->getAccessArea(); unsigned long usedAddress = theBlock_->getAddress(); unsigned long usedSize = theBlock_->getMemSize(); unsigned long usedDeviceOffset = pDev->getInputAddress(area) * usedSize; @@ -148,7 +148,6 @@ int PLCRecvBlockMode::execute(Context* pContext) //begin critical section Lock lock(bufferMux_); - AccessArea area = theBlock_->getAccessArea(); switch (area) { case Digital: @@ -204,6 +203,7 @@ int PLCRecvDeviceMode::execute(Context* pContext) timeval tod; //Time-of-day for register time-stamping int errorCode = 0; Connection* pConn = theBlock_->getPLC()->getConnection(); + AccessArea area = theBlock_->getAccessArea(); try { @@ -214,7 +214,6 @@ int PLCRecvDeviceMode::execute(Context* pContext) Device* pDev = pContext->getDevice(); //Set base attributes of the device blocks - AccessArea area = theBlock_->getAccessArea(); unsigned long usedDeviceAddress = pDev->getInputAddress(area); unsigned long usedBlockAddress = theBlock_->getAddress(); unsigned long usedSize = theBlock_->getMemSize(); @@ -297,7 +296,6 @@ int PLCRecvDeviceMode::execute(Context* pContext) } //begin critical section Lock lock(bufferMux_); - AccessArea area = theBlock_->getAccessArea(); switch (area) { case Digital: -- GitLab