[tools] winetest/build-patterns: Use while to read from file descriptors.

Francois Gouget fgouget at codeweavers.com
Mon May 17 03:23:10 CDT 2021


Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
foreach reads the whole file (converts it into a list that can be 
iterated) even if one exits the loop early with last. That would be 
confusing should we ever need to do so. So I think it's better to read 
files with while.
---
 winetest/build-patterns | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winetest/build-patterns b/winetest/build-patterns
index 6076d18ab..3c9b8aa84 100755
--- a/winetest/build-patterns
+++ b/winetest/build-patterns
@@ -677,7 +677,7 @@ if (open(my $fh, "-|", $cmd))
 {
     my $index = 0;
     my ($commit, $build);
-    foreach my $line (<$fh>)
+    while (my $line = <$fh>)
     {
         chomp $line;
         if ($line =~ /^([0-9a-f]{40}) (.*)$/)
-- 
2.20.1



More information about the wine-devel mailing list