[dpkg] 167/192: Dpkg::Control::HashCore: Optimize trailing space trimming in parse()

Ximin Luo infinity0 at debian.org
Tue Oct 17 11:04:14 UTC 2017


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

infinity0 pushed a commit to branch pu/reproducible_builds
in repository dpkg.

commit f5b7b766b4d9f07f8de7c7ad040b747ffb1cb014
Author: Guillem Jover <guillem at debian.org>
Date:   Thu Sep 28 02:52:12 2017 +0200

    Dpkg::Control::HashCore: Optimize trailing space trimming in parse()
    
    We should only apply the "costly" substitution when there is at least
    one whitespace.
---
 debian/changelog                 | 2 ++
 scripts/Dpkg/Control/HashCore.pm | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 83b379e..78f9d9d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -96,6 +96,8 @@ dpkg (1.19.0) UNRELEASED; urgency=medium
       in Dpkg::Control::HashCore parse method.
     - Optimize trailing space matching on Dpkg::Control::HashCore parse
       method, by trimming it just once at the beginning of the iteration.
+    - Optimize trailing space trimming on Dpkg::Control::HashCore parse
+      method, by requiring that at least one whitespace is present.
   * Documentation:
     - Document currently accepted syntax for changelogs in deb-changelog(5).
       Closes: #858579
diff --git a/scripts/Dpkg/Control/HashCore.pm b/scripts/Dpkg/Control/HashCore.pm
index 3504e99..f33c156 100644
--- a/scripts/Dpkg/Control/HashCore.pm
+++ b/scripts/Dpkg/Control/HashCore.pm
@@ -204,7 +204,7 @@ sub parse {
         # s/// doing anything, which gives usa significant speed up.
 	chomp;
         my $armor = $_;
-        s/\s*$//;
+        s/\s+$//;
 
         next if length == 0 and $paraborder;
 	next if substr($_, 0, 1) eq '#';

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



More information about the Reproducible-commits mailing list