[lintian] 01/08: L::Util: Assume that file names rarely contain backslash
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch master
in repository lintian.
commit 7bceae9059fe971f51fa87e0e9a87616467f8df7
Author: Niels Thykier <niels@thykier.net>
Date: Mon Feb 24 21:46:05 2014 +0100
L::Util: Assume that file names rarely contain backslash
Optimise for the case where file names do no have backslash as it
fairly uncommon in "your average package".
Signed-off-by: Niels Thykier <niels@thykier.net>
---
lib/Lintian/Util.pm | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/Lintian/Util.pm b/lib/Lintian/Util.pm
index 10cf506..c12e1d7 100644
--- a/lib/Lintian/Util.pm
+++ b/lib/Lintian/Util.pm
@@ -1167,8 +1167,12 @@ sub dequote_name {
my ($name, $slsd) = @_;
$slsd = 1 unless defined $slsd;
$name =~ s,^\.?/,, if $slsd;
- $name =~ s/(\G|[^\\](?:\\\\)*)\\(\d{3})/"$1" . chr(oct $2)/ge;
- $name =~ s/\\\\/\\/g;
+ # Optimise for the case where the filename does not contain
+ # backslashes. It is a fairly rare to see that in practise.
+ if (index($name, '\\') > -1) {
+ $name =~ s/(\G|[^\\](?:\\\\)*)\\(\d{3})/"$1" . chr(oct $2)/ge;
+ $name =~ s/\\\\/\\/g;
+ }
return $name;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: