1
0
Fork 0
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:
Marcin Bukat 2011-03-02 09:22:42 +00:00
parent 74b7b3f1b0
commit c9b0044274

View file

@ -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
@ -350,7 +341,7 @@ sub compare {
$l = "### The 'desc' field differs from the english!\n### the previously used desc is commented below:\n### desc: $ldesc\n desc: $edesc\n";
}
push @show, $l;
}
}
elsif($l =~ / *\<source\>/i) {
$mode=1;
push @show, $l;
@ -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