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

guillem pushed a commit to branch master
in repository dpkg.

commit 7c75716f63cce2eabe6430fb573d711d0e519b2d
Author: Guillem Jover <[email protected]>
Date:   Sat Jul 15 01:55:35 2017 +0200

    Dpkg::Control::HashCore: Use substr instead of a regex
    
    When we want to match the first character on a parsed control file line,
    using substr is more efficient than using a regex.
---
 debian/changelog                 | 2 ++
 scripts/Dpkg/Control/HashCore.pm | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index b61851f..c62d234 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -54,6 +54,8 @@ dpkg (1.19.0) UNRELEASED; urgency=medium
       handling in Dpkg::Control::FieldsCore, giving a significant speed up.
     - Remove dependency on Dpkg::Checksums from Dpkg::Control::FieldsCore.
     - Do not execute code when importing Dpkg::Control::FieldsCore.
+    - Use substr instead of a regex to match the first line characters in
+      when parsing control files in Dpkg::Control::HashCore.
   * 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 c4f025f..17d8ed7 100644
--- a/scripts/Dpkg/Control/HashCore.pm
+++ b/scripts/Dpkg/Control/HashCore.pm
@@ -201,12 +201,12 @@ sub parse {
     while (<$fh>) {
        chomp;
        next if m/^\s*$/ and $paraborder;
-       next if (m/^#/);
+       next if substr($_, 0, 1) eq '#';
        $paraborder = 0;
        if (m/^(\S+?)\s*:\s*(.*)$/) {
            $parabody = 1;
            my ($name, $value) = ($1, $2);
-           if ($name =~ m/^-/) {
+           if (substr($name, 0, 1) eq '-') {
                $self->parse_error($desc, g_('field cannot start with a 
hyphen'));
            }
            if (exists $self->{$name}) {

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

Reply via email to