From 7c75716f63cce2eabe6430fb573d711d0e519b2d Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Sat, 15 Jul 2017 01:55:35 +0200 Subject: 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. --- scripts/Dpkg/Control/HashCore.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts/Dpkg/Control') diff --git a/scripts/Dpkg/Control/HashCore.pm b/scripts/Dpkg/Control/HashCore.pm index c4f025ff8..17d8ed7dd 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}) { -- cgit v1.2.3