Skip to content

Commit ec7894a

Browse files
committed
ParseXS: standard_typemap_locations(): rm cache
standard_typemap_locations() has a static variable, @tm_template, which it populates with all the '../../typemap' etc paths on first call, then reuses on subsequent calls. This doesn't seem very useful, since standard_typemap_locations() is typically only called once per run of xsubpp etc. And anyway, regenerating those paths (which doesn't involve any IO) isn't costly. So simplify the code by removing the cache.
1 parent 9ef3303 commit ec7894a

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Utilities.pm

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,10 @@ A list of F<typemap> pathnames.
107107
108108
=cut
109109

110-
SCOPE: {
111-
my @tm_template;
112-
113110
sub standard_typemap_locations {
114111
my $include_ref = shift;
115112

116-
if (not @tm_template) {
117-
@tm_template = qw(typemap);
113+
my @tm = qw(typemap);
118114

119115
my $updir = File::Spec->updir();
120116
foreach my $dir (
@@ -123,19 +119,16 @@ SCOPE: {
123119
File::Spec->catdir(($updir) x 3),
124120
File::Spec->catdir(($updir) x 4),
125121
) {
126-
unshift @tm_template, File::Spec->catfile($dir, 'typemap');
127-
unshift @tm_template, File::Spec->catfile($dir, lib => ExtUtils => 'typemap');
122+
unshift @tm, File::Spec->catfile($dir, 'typemap');
123+
unshift @tm, File::Spec->catfile($dir, lib => ExtUtils => 'typemap');
128124
}
129-
}
130125

131-
my @tm = @tm_template;
132126
foreach my $dir (@{ $include_ref}) {
133127
my $file = File::Spec->catfile($dir, ExtUtils => 'typemap');
134128
unshift @tm, $file;
135129
}
136130
return @tm;
137131
}
138-
} # end SCOPE
139132

140133
=head2 C<trim_whitespace()>
141134

0 commit comments

Comments
 (0)