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:
parent
c9e00806d4
commit
6170ded83d
1 changed files with 7 additions and 5 deletions
|
@ -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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue