Change variable scopes

cppcheck correctly notes that a lot of our variables can be declared at
more specific scopes, and in every case, it seems to be correct.

Tested: Redfish service validator passes.  Unit test coverage on others.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ia4414410d0e8f74a3bd40fdc0e0232450d1a6416
diff --git a/include/ibm/locks.hpp b/include/ibm/locks.hpp
index e713f97..e3abb46 100644
--- a/include/ibm/locks.hpp
+++ b/include/ibm/locks.hpp
@@ -431,12 +431,9 @@
 
 inline Rc Lock::isConflictWithTable(const LockRequests& refLockRequestStructure)
 {
-
-    uint32_t thisTransactionId = 0;
-
     if (lockTable.empty())
     {
-        thisTransactionId = generateTransactionId();
+        uint32_t thisTransactionId = generateTransactionId();
         BMCWEB_LOG_DEBUG << thisTransactionId;
         // Lock table is empty, so we are safe to add the lockrecords
         // as there will be no conflict