[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[lintian] 01/01: r/html_reports: Use tr instead of s and skip some html_quote



This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository lintian.

commit 1561c2a994429fe7165b5a9bb1bcf2ba7106ddda
Author: Niels Thykier <niels@thykier.net>
Date:   Tue Feb 4 22:56:31 2014 +0100

    r/html_reports: Use tr instead of s and skip some html_quote
    
    Using tr///c instead of s///g for replacing single characters with "_"
    (since tr is faster than s for this task).  Due to the whitelist used
    we can skip the call to html_quote.
    
    At the same time, sanitize related values in the same way.
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 reporting/html_reports | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/reporting/html_reports b/reporting/html_reports
index 6ba38dc..0575aac 100755
--- a/reporting/html_reports
+++ b/reporting/html_reports
@@ -283,8 +283,10 @@ while (<>) {
     $statistics{maintainers}++ unless defined $by_maint{$maintainer};
 
     # Sanitize, just out of paranoia.
-    $source =~ s/[^a-zA-Z0-9.+-]/_/g;
-    $version =~ s/[^a-zA-Z0-9.+:~-]/_/g;
+    $package =~ tr/a-zA-Z0-9.+-/_/c;
+    $source =~ tr/a-zA-Z0-9.+-/_/c;
+    $version =~ tr/a-zA-Z0-9.+:~-/_/c;
+    $source_version =~ tr/a-zA-Z0-9.+:~-/_/c;
 
     # Add the tag information to our hashes.  Share the data between the
     # hashes to save space (which means we can't later do destructive tricks
@@ -292,8 +294,8 @@ while (<>) {
     my $info = {
         # split_tags ensures that $code is a single upper case letter
         code      => $code,
-        package   => html_quote($package),
-        version   => html_quote($version),
+        package   => $package,
+        version   => $version,
         area      => html_quote($area),
         type      => html_quote($type),
         tag       => html_quote($tag),

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: