The following commit has been merged in the master branch:
commit 734a784e75b71b31179327a7f284f76e3bbcb14e
Author: Frank Lichtenheld <[email protected]>
Date: Sun Mar 29 13:18:39 2009 +0200
Simplify Dpkg::Version
Remove unnecessary function next_elem which just replicates the
standard shift behaviour. The additional function calls affect
performance negatively.
diff --git a/debian/changelog b/debian/changelog
index 528cf48..de3bfd3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -53,6 +53,10 @@ dpkg (1.15.1) UNRELEASED; urgency=low
* Fix typo in dpkg output (‘unexecpted’ → ‘unexpected’). Closes: #519082
Thanks to Ivan Masár.
+ [ Frank Lichtenheld ]
+ * Dpkg::Version: Remove unnecessary function next_elem which just
+ replicates the standard shift behaviour.
+
[ Updated dselect translations ]
* German (Sven Joachim).
* Swedish (Peter Krefting).
@@ -75,7 +79,7 @@ dpkg (1.15.1) UNRELEASED; urgency=low
* German (Helge Kreutzmann).
* Swedish (Peter Krefting).
- -- Guillem Jover <[email protected]> Mon, 02 Mar 2009 06:22:36 +0200
+ -- Frank Lichtenheld <[email protected]> Sun, 29 Mar 2009 13:14:30 +0200
dpkg (1.15.0) experimental; urgency=low
diff --git a/scripts/Dpkg/Version.pm b/scripts/Dpkg/Version.pm
index e9d1146..a7ad1c3 100644
--- a/scripts/Dpkg/Version.pm
+++ b/scripts/Dpkg/Version.pm
@@ -99,7 +99,7 @@ sub verrevcmp($$)
elsif ($x =~ /^\d$/) {
return 0;
}
- elsif ($x =~ /^[A-Z]$/i) {
+ elsif ($x =~ /^[A-Za-z]$/) {
return ord($x);
}
else {
@@ -107,17 +107,13 @@ sub verrevcmp($$)
}
}
- sub next_elem(\@){
- my $a = shift;
- return @{$a} ? shift @{$a} : undef;
- }
my ($val, $ref) = @_;
$val = "" if not defined $val;
$ref = "" if not defined $ref;
my @val = split //,$val;
my @ref = split //,$ref;
- my $vc = next_elem @val;
- my $rc = next_elem @ref;
+ my $vc = shift @val;
+ my $rc = shift @ref;
while (defined $vc or defined $rc) {
my $first_diff = 0;
while ((defined $vc and $vc !~ /^\d$/) or
@@ -125,18 +121,18 @@ sub verrevcmp($$)
my $vo = order($vc); my $ro = order($rc);
# Unlike dpkg's verrevcmp, we only return 1 or -1 here.
return (($vo - $ro > 0) ? 1 : -1) if $vo != $ro;
- $vc = next_elem @val; $rc = next_elem @ref;
+ $vc = shift @val; $rc = shift @ref;
}
while (defined $vc and $vc eq '0') {
- $vc = next_elem @val;
+ $vc = shift @val;
}
while (defined $rc and $rc eq '0') {
- $rc = next_elem @ref;
+ $rc = shift @ref;
}
while (defined $vc and $vc =~ /^\d$/ and
defined $rc and $rc =~ /^\d$/) {
$first_diff = ord($vc) - ord($rc) if !$first_diff;
- $vc = next_elem @val; $rc = next_elem @ref;
+ $vc = shift @val; $rc = shift @ref;
}
return 1 if defined $vc and $vc =~ /^\d$/;
return -1 if defined $rc and $rc =~ /^\d$/;
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]