Almost 30% faster.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29488 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Björn Stenberg 2011-03-02 00:20:56 +00:00
parent c9e00806d4
commit 6170ded83d

View file

@ -121,6 +121,8 @@ if(!$target && !$update && !$sortfile) {
print STDERR "Please specify a target (with -t)!\n";
exit;
}
my @target_parts = split ':', $target;
my $verbose=$v;
my %id; # string to num hash
@ -149,9 +151,6 @@ sub trim {
sub match {
my ($string, $pattern)=@_;
$pattern =~ s/\*/.*/g;
$pattern =~ s/\?/./g;
return ($string =~ /^$pattern\z/);
}
@ -183,9 +182,12 @@ sub parsetarget {
my @all= split(" *, *", $n);
my $test;
for $test (@all) {
$test =~ s/\*/.*/g;
$test =~ s/\?/./g;
# print "TEST ($debug) $target for $test\n";
for my $part (split(":", $target)) {
if(match($part, $test)) {
for my $part (@target_parts) {
if($part =~ /^$test\z/) {
$string = $v;
# print "MATCH: $test => $v\n";
$$strref = $string;