diff options
author | Nicholas Clark <nick@ccl4.org> | 2013-06-17 11:27:16 +0200 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2013-07-02 15:33:28 +0200 |
commit | 33881c928ba43758652bf4037675cb7216359ce3 (patch) | |
tree | d4e22e3d5198afc5c65fb84658a288a6f5dc7661 /win32/FindExt.pm | |
parent | e298842055e9af7cdfaee43509096b8dcbb7036c (diff) | |
download | perl-33881c928ba43758652bf4037675cb7216359ce3.tar.gz |
Refactor FindExt, merging scan_ext() and find_ext().
The return value of FindExt::scan_ext() has never been used, since FindExt
was first added by commit 8e2329934bcca9c5 in April 2001. The call to
FindExt::extensions() has no side effects, so it can be eliminated. Hence
FindExt::scan_ext() is a trivial wrapper around FindExt::find_ext(), and the
two can be merged.
Also, simplify the logic for "known" extensions. The complexity of checking
the hash first was needed when extension directories were nested. It should
have been removed as part of commit 1f8a0b38638b171c in Feb 2009.
Diffstat (limited to 'win32/FindExt.pm')
-rw-r--r-- | win32/FindExt.pm | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/win32/FindExt.pm b/win32/FindExt.pm index 4a8dc5f135..55c1ce6798 100644 --- a/win32/FindExt.pm +++ b/win32/FindExt.pm @@ -66,13 +66,6 @@ sub set_static_extensions { } } -sub scan_ext -{ - my $dir = shift; - find_ext("$dir/"); - extensions(); -} - sub _ext_eq { my $key = shift; sub { @@ -108,14 +101,14 @@ sub has_xs_or_c { } # Function to find available extensions, ignoring DynaLoader -sub find_ext +sub scan_ext { my $ext_dir = shift; opendir my $dh, "$ext_dir"; while (defined (my $item = readdir $dh)) { next if $item =~ /^\.\.?$/; next if $item eq "DynaLoader"; - next unless -d "$ext_dir$item"; + next unless -d "$ext_dir/$item"; my $this_ext = $item; my $leaf = $item; @@ -125,12 +118,12 @@ sub find_ext # Temporary hack to cope with smokers that are not clearing directories: next if $ext{$this_ext}; - if (has_xs_or_c("$ext_dir$item")) { + if (has_xs_or_c("$ext_dir/$item")) { $ext{$this_ext} = $static{$this_ext} ? 'static' : 'dynamic'; } else { $ext{$this_ext} = 'nonxs'; } - $ext{$this_ext} = 'known' if $ext{$this_ext} && $item =~ $no; + $ext{$this_ext} = 'known' if $item =~ $no; } } |