SVN: vfmg/trunk/vfmg
sparky
sparky at pld-linux.org
Sat Dec 2 21:10:30 CET 2006
Author: sparky
Date: Sat Dec 2 21:10:28 2006
New Revision: 8035
Modified:
vfmg/trunk/vfmg
Log:
- some findfirstlang speed-up
Modified: vfmg/trunk/vfmg
==============================================================================
--- vfmg/trunk/vfmg (original)
+++ vfmg/trunk/vfmg Sat Dec 2 21:10:28 2006
@@ -301,13 +301,16 @@
}
addlang($ENV{'LANG'}) if exists $ENV{'LANG'};
my $langs = join "|", @lang;
-sub findfirstlang {
+sub findfirstlang($) {
+ my $in = shift;
+ my %in_file;
+ foreach (@{$in}) {
+ $in_file{$1} = $_ if /\[(.*)\]/;
+ }
foreach my $lang (@lang) {
- foreach (@_) {
- return $_ if /\[$lang\]/;
- }
+ return $in_file{$lang} if exists $in_file{$lang};
}
- return (grep !/\[.*\]/, @_)[0];
+ return (grep !/\[.*\]$/, @{$in})[0];
} # }}}
# what is $DESKTOP_FILE_PATH?
@@ -394,7 +397,7 @@
foreach my $tag_name (@decode_tags) {
my @all = (grep /^$tag_name/, keys %tags);
next if ($#all < 0);
- my $first = findfirstlang(@all);
+ my $first = findfirstlang(\@all);
my $enc = $tags{Encoding};
if ($enc eq 'Legacy-Mixed') {
@@ -676,8 +679,9 @@
\s*$/ox
} <F_IN>,
);
- $dname = $tags{findfirstlang( grep /^Name/, keys %tags)};
close F_IN;
+ my @name = grep /^Name/, keys %tags;
+ $dname = $tags{findfirstlang( \@name )};
$ok = 1;
if($opt{icons_ext}) {
More information about the pld-cvs-commit
mailing list