forked from len0rd/rockbox
genlang: Remove unused subs. Use precompiled regex in parsetarget(). Minor tweek by substituting s/\r//g with tr/\r//d.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29494 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
74b7b3f1b0
commit
c9b0044274
1 changed files with 6 additions and 15 deletions
|
@ -148,16 +148,6 @@ sub trim {
|
|||
return $string;
|
||||
}
|
||||
|
||||
sub match {
|
||||
my ($string, $pattern)=@_;
|
||||
|
||||
return ($string =~ /^$pattern\z/);
|
||||
}
|
||||
|
||||
sub blank {
|
||||
# nothing to do
|
||||
}
|
||||
|
||||
my %head;
|
||||
sub header {
|
||||
my ($full, $n, $v)=@_;
|
||||
|
@ -181,13 +171,14 @@ sub parsetarget {
|
|||
my $string;
|
||||
my @all= split(" *, *", $n);
|
||||
my $test;
|
||||
my $regexp;
|
||||
for $test (@all) {
|
||||
$test =~ s/\*/.*/g;
|
||||
$test =~ s/\?/./g;
|
||||
|
||||
$regexp = qr/^$test\z/;
|
||||
# print "TEST ($debug) $target for $test\n";
|
||||
for my $part (@target_parts) {
|
||||
if($part =~ /^$test\z/) {
|
||||
if($part =~ $regexp) {
|
||||
$string = $v;
|
||||
# print "MATCH: $test => $v\n";
|
||||
$$strref = $string;
|
||||
|
@ -233,7 +224,7 @@ if($english) {
|
|||
while(<ENG>) {
|
||||
|
||||
# get rid of DOS newlines
|
||||
$_ =~ s/\r//g;
|
||||
$_ =~ tr/\r//d;
|
||||
|
||||
if($_ =~ /^ *\<phrase\>/) {
|
||||
# this is the start of a phrase
|
||||
|
@ -409,7 +400,7 @@ while(<LANG>) {
|
|||
$line++;
|
||||
|
||||
# get rid of DOS newlines
|
||||
$_ =~ s/\r//g;
|
||||
$_ =~ tr/\r//d;
|
||||
|
||||
if($_ =~ /^( *\#|[ \t\n\r]*\z)/) {
|
||||
# comment or empty line - output it if it's part of the header
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue