From e48e0e7cb0fe51cc676b894cdce9eebeca7d5991 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 28 Jul 2010 15:13:34 +0200 Subject: put iterator variables into loop headers Reviewed-by: joerg --- bin/syncqt | 57 +++++++++++++++++++-------------------------------------- 1 file changed, 19 insertions(+), 38 deletions(-) diff --git a/bin/syncqt b/bin/syncqt index 4acb5b5..c9f2223 100755 --- a/bin/syncqt +++ b/bin/syncqt @@ -297,8 +297,7 @@ sub classNames { push @symbols, "QMutable" . $1 . "Iterator"; } - foreach (@symbols) { - my $symbol = $_; + foreach my $symbol (@symbols) { $symbol = (join("::", @namespaces) . "::" . $symbol) if (scalar @namespaces); push @ret, $symbol if ($symbol =~ /^Q[^:]*$/ # no-namespace, starting with Q @@ -696,9 +695,8 @@ my %inject_headers; # find the header by normal means. %inject_headers = ( "$basedir/src/corelib/global" => ( "*qconfig.h" ) ) unless (-e "$basedir/src/corelib/global/qconfig.h"); -foreach (@modules_to_sync) { +foreach my $lib (@modules_to_sync) { #iteration info - my $lib = $_; my $dir = "$modules{$lib}"; my $pathtoheaders = ""; $pathtoheaders = "$moduleheaders{$lib}" if ($moduleheaders{$lib}); @@ -715,8 +713,7 @@ foreach (@modules_to_sync) { #get dependencies if(-e "$dir/" . basename($dir) . ".pro") { if(open(F, "<$dir/" . basename($dir) . ".pro")) { - while() { - my $line = $_; + while(my $line = ) { chomp $line; if($line =~ /^ *QT *\+?= *([^\r\n]*)/) { foreach(split(/ /, "$1")) { @@ -743,8 +740,7 @@ foreach (@modules_to_sync) { #remove the old files if($remove_stale) { my @subdirs = ("$out_basedir/include/$lib"); - foreach (@subdirs) { - my $subdir = "$_"; + foreach my $subdir (@subdirs) { if (opendir DIR, "$subdir") { while(my $t = readdir(DIR)) { my $file = "$subdir/$t"; @@ -753,12 +749,10 @@ foreach (@modules_to_sync) { } else { my @files = ("$file"); #push @files, "$out_basedir/include/Qt/$t" if(-e "$out_basedir/include/Qt/$t"); - foreach (@files) { - my $file = $_; + foreach my $file (@files) { my $remove_file = 0; if(open(F, "<$file")) { - while() { - my $line = $_; + while(my $line = ) { chomp $line; if($line =~ /^\#include \"([^\"]*)\"$/) { my $include = $1; @@ -782,14 +776,12 @@ foreach (@modules_to_sync) { } #create the new ones - foreach (split(/;/, $dir)) { - my $current_dir = "$_"; + foreach my $current_dir (split(/;/, $dir)) { my $headers_dir = $current_dir; $headers_dir .= "/$pathtoheaders" if ($pathtoheaders); #calc subdirs my @subdirs = ($headers_dir); - foreach (@subdirs) { - my $subdir = "$_"; + foreach my $subdir (@subdirs) { opendir DIR, "$subdir" or next; while(my $t = readdir(DIR)) { push @subdirs, "$subdir/$t" if(-d "$subdir/$t" && !($t eq ".") && @@ -801,12 +793,10 @@ foreach (@modules_to_sync) { } #calc files and "copy" them - foreach (@subdirs) { - my $subdir = "$_"; + foreach my $subdir (@subdirs) { my @headers = findFiles("$subdir", "^[-a-z0-9_]*\\.h\$" , 0); push @headers, $inject_headers{$subdir} if (defined $inject_headers{$subdir}); - foreach (@headers) { - my $header = "$_"; + foreach my $header (@headers) { my $shadow = ($header =~ s/^\*//); $header = 0 if("$header" =~ /^ui_.*.h/); foreach (@ignore_headers) { @@ -862,15 +852,15 @@ foreach (@modules_to_sync) { close HEADERFILE; } - foreach(@classes) { + foreach my $full_class (@classes) { my $header_base = basename($header); - my $class = $_; # Strip namespaces: + my $class = $full_class; $class =~ s/^.*:://; # if ($class =~ m/::/) { # class =~ s,::,/,g; # } - $class_lib_map_contents .= "QT_CLASS_LIB($_, $lib, $header_base)\n"; + $class_lib_map_contents .= "QT_CLASS_LIB($full_class, $lib, $header_base)\n"; $header_copies++ if(syncHeader("$out_basedir/include/$lib/$class", "$out_basedir/include/$lib/$header", 0)); # KDE-Compat headers for Phonon @@ -892,8 +882,7 @@ foreach (@modules_to_sync) { #deal with the install directives if($public_header) { my $pri_install_iheader = fixPaths($iheader, $current_dir); - foreach(@classes) { - my $class = $_; + foreach my $class (@classes) { # Strip namespaces: $class =~ s/^.*:://; # if ($class =~ m/::/) { @@ -994,14 +983,10 @@ unless($showonly || !$create_uic_class_map) { } if($check_includes) { - for (keys(%modules)) { - #iteration info - my $lib = $_; - { + for my $lib (keys(%modules)) { #calc subdirs my @subdirs = ($modules{$lib}); - foreach (@subdirs) { - my $subdir = "$_"; + foreach my $subdir (@subdirs) { opendir DIR, "$subdir" or die "Huh, directory ".$subdir." cannot be opened."; while(my $t = readdir(DIR)) { push @subdirs, "$subdir/$t" if(-d "$subdir/$t" && !($t eq ".") && @@ -1012,8 +997,7 @@ if($check_includes) { closedir DIR; } - foreach (@subdirs) { - my $subdir = "$_"; + foreach my $subdir (@subdirs) { my $header_skip_qt_module_test = 0; foreach(@ignore_for_qt_module_check) { foreach (split(/;/, $_)) { @@ -1021,8 +1005,7 @@ if($check_includes) { } } my @headers = findFiles("$subdir", "^[-a-z0-9_]*\\.h\$" , 0); - foreach (@headers) { - my $header = "$_"; + foreach my $header (@headers) { my $header_skip_qt_begin_header_test = 0; my $header_skip_qt_begin_namespace_test = 0; $header = 0 if("$header" =~ /^ui_.*.h/); @@ -1074,8 +1057,7 @@ if($check_includes) { $include = 0; } if($include) { - for (keys(%modules)) { - my $trylib = $_; + for my $trylib (keys(%modules)) { if(-e "$out_basedir/include/$trylib/$include") { print "WARNING: $iheader includes $include when it should include $trylib/$include\n"; } @@ -1124,7 +1106,6 @@ if($check_includes) { } } } - } } } -- cgit v0.12