summaryrefslogtreecommitdiffstats
path: root/tools/genlang
diff options
context:
space:
mode:
authorMarcin Bukat <marcin.bukat@gmail.com>2011-03-02 09:22:42 +0000
committerMarcin Bukat <marcin.bukat@gmail.com>2011-03-02 09:22:42 +0000
commitc9b0044274bc3871311e84ced66f4aaec6b48355 (patch)
treed2b8ce8c0ce8d7363d72472e9bf15a8af200c8f2 /tools/genlang
parent74b7b3f1b07ad8c38c6f58f8a7540a183d4b7473 (diff)
downloadrockbox-c9b0044274bc3871311e84ced66f4aaec6b48355.tar.gz
rockbox-c9b0044274bc3871311e84ced66f4aaec6b48355.zip
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
Diffstat (limited to 'tools/genlang')
-rwxr-xr-xtools/genlang21
1 files changed, 6 insertions, 15 deletions
diff --git a/tools/genlang b/tools/genlang
index 81d5066453..6a63f8004e 100755
--- a/tools/genlang
+++ b/tools/genlang
@@ -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