1
0
Fork 0
forked from len0rd/rockbox

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