Commit b38a5ba0628f1b3d1b5b3862f6451ccb5793aad3

Ryan C. Gordon 2019-10-05T20:19:10

dynapi: Make gendynapi.pl work on older Perl releases.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/src/dynapi/gendynapi.pl b/src/dynapi/gendynapi.pl
index bdf03d2..43e8c63 100755
--- a/src/dynapi/gendynapi.pl
+++ b/src/dynapi/gendynapi.pl
@@ -49,9 +49,9 @@ open(SDL_DYNAPI_PROCS_H, '>>', $sdl_dynapi_procs_h) or die("Can't open $sdl_dyna
 open(SDL_DYNAPI_OVERRIDES_H, '>>', $sdl_dynapi_overrides_h) or die("Can't open $sdl_dynapi_overrides_h: $!\n");
 
 opendir(HEADERS, 'include') or die("Can't open include dir: $!\n");
-while (readdir(HEADERS)) {
-    next if not /\.h\Z/;
-    my $header = "include/$_";
+while (my $d = readdir(HEADERS)) {
+    next if not $d =~ /\.h\Z/;
+    my $header = "include/$d";
     open(HEADER, '<', $header) or die("Can't open $header: $!\n");
     while (<HEADER>) {
         chomp;