diff options
author | Nicholas Clark <nick@ccl4.org> | 2006-01-08 13:15:30 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2006-01-08 13:15:30 +0000 |
commit | a146a244ce1425446618620fe96b3481b5463a4f (patch) | |
tree | b696693f33ddd6e37be78bf7ebb59d0414732df6 /ext/POSIX | |
parent | afd78fd5455826b5a73217b8c80ab30a9cdad730 (diff) | |
download | perl-a146a244ce1425446618620fe96b3481b5463a4f.tar.gz |
Tweak the code that generates unique entries in @POSIX::EXPORT so that
the array ends up with shared hash key scalars, for a memory saving.
p4raw-id: //depot/perl@26709
Diffstat (limited to 'ext/POSIX')
-rw-r--r-- | ext/POSIX/POSIX.pm | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/ext/POSIX/POSIX.pm b/ext/POSIX/POSIX.pm index cd6188d062..895c554640 100644 --- a/ext/POSIX/POSIX.pm +++ b/ext/POSIX/POSIX.pm @@ -960,10 +960,11 @@ sub load_imports { # Exporter::export_tags(); { # De-duplicate the export list: - my %seen; - for (values %EXPORT_TAGS) { - push @EXPORT, grep {!$seen{$_}++} @$_; - } + my %export; + @export{map {@$_} values %EXPORT_TAGS} = (); + # Doing the de-dup with a temporary hash has the advantage that the SVs in + # @EXPORT are actually shared hash key sacalars, which will save some memory. + push @EXPORT, keys %export; } @EXPORT_OK = qw( |