summaryrefslogtreecommitdiff
path: root/scripts/Dpkg/Control
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2017-07-15 01:55:35 +0200
committerGuillem Jover <guillem@debian.org>2017-09-24 21:03:10 +0200
commit7c75716f63cce2eabe6430fb573d711d0e519b2d (patch)
treeb82184a8cd3b084b384bee88168cf53d435405b3 /scripts/Dpkg/Control
parentf0fa8190fe02bb9db8168ae6a67f592f135b06c2 (diff)
downloaddpkg-7c75716f63cce2eabe6430fb573d711d0e519b2d.tar.gz
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.
Diffstat (limited to 'scripts/Dpkg/Control')
-rw-r--r--scripts/Dpkg/Control/HashCore.pm4
1 files changed, 2 insertions, 2 deletions
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}) {