From 1dd1e48e7328db9d17de3e5f1bd6ca257f4ccee2 Mon Sep 17 00:00:00 2001
From: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Date: Thu, 26 Nov 2015 17:15:38 +0100
Subject: [PATCH] Simplify tests whether to run header checks

Turn lists into hashes and check for existence of an element using key
lookup. This leads to simpler testing code and is potentially faster.

Change-Id: Ibbf4f03ec64d6c295cc5e1664dfa73cd0ce8c272
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
---
 bin/syncqt.pl | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/bin/syncqt.pl b/bin/syncqt.pl
index 83e8350f819..25c129f2684 100755
--- a/bin/syncqt.pl
+++ b/bin/syncqt.pl
@@ -81,6 +81,8 @@ our @qpa_headers = ();
 
 # will be derived from sync.profile
 our %reverse_classnames = ();
+my %ignore_for_include_check = ();
+my %ignore_for_qt_begin_namespace_check = ();
 
 # global variables (modified by options)
 my $isunix = 0;
@@ -801,6 +803,8 @@ loadSyncProfile(\$basedir, \$out_basedir);
 @modules_to_sync = keys(%modules) if($#modules_to_sync == -1);
 
 my %allmoduleheadersprivate = map { $_ => 1 } @allmoduleheadersprivate;
+%ignore_for_include_check = map { $_ => 1 } @ignore_for_include_check;
+%ignore_for_qt_begin_namespace_check = map { $_ => 1 } @ignore_for_qt_begin_namespace_check;
 
 $isunix = checkUnix; #cache checkUnix
 
@@ -1157,12 +1161,8 @@ if($check_includes) {
                                 $public_header = 0 if($header eq $_);
                             }
                             if($public_header) {
-                                foreach (@ignore_for_include_check) {
-                                    $public_header = 0 if($header eq $_);
-                                }
-                                foreach(@ignore_for_qt_begin_namespace_check) {
-                                    $header_skip_qt_begin_namespace_test = 1 if ($header eq $_);
-                                }
+                                $public_header = 0 if ($ignore_for_include_check{$header});
+                                $header_skip_qt_begin_namespace_test = 1 if ($ignore_for_qt_begin_namespace_check{$header});
                             }
                         }
 
-- 
GitLab