From e34b7405ad2ec4dec4c70d0e40307c671f59dafe Mon Sep 17 00:00:00 2001
From: Maciej Szymanski <maciej.szymanski@cern.ch>
Date: Thu, 21 Dec 2023 23:34:03 +0100
Subject: [PATCH] avoid redundant calls to GetLast()

---
 Control/xAODRootAccess/Root/Utils.cxx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Control/xAODRootAccess/Root/Utils.cxx b/Control/xAODRootAccess/Root/Utils.cxx
index dd29fb06acc5..dd1f6205d133 100644
--- a/Control/xAODRootAccess/Root/Utils.cxx
+++ b/Control/xAODRootAccess/Root/Utils.cxx
@@ -320,7 +320,7 @@ namespace xAOD {
          const TObjArray * pBranches = tree->GetListOfBranches();
          const std::regex pattern( ".*" + pre + ".*" );
 
-         for( int i = 0; i <= pBranches->GetLast() ; ++i ) {
+         for( int i = 0, nLast = pBranches->GetLast(); i <= nLast; ++i ) {
             const std::string name = pBranches->At(i)->GetName();
 
             if( std::regex_match( name, pattern ) )
-- 
GitLab