diff options
author | Guillem Jover <guillem@debian.org> | 2017-09-28 09:28:24 +0200 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2017-10-16 11:04:29 +0200 |
commit | a76b755572bfd7b106ef283193d32fba8cbc5dd1 (patch) | |
tree | c56ee4b7e55b3f6cc171e65a04e1ec796d744b8a /scripts/Dpkg/Control/HashCore.pm | |
parent | f5b7b766b4d9f07f8de7c7ad040b747ffb1cb014 (diff) | |
download | dpkg-a76b755572bfd7b106ef283193d32fba8cbc5dd1.tar.gz |
Dpkg::Control::HashCore: Optimize first character matching in parse()
We store the first character in a variable.
Diffstat (limited to 'scripts/Dpkg/Control/HashCore.pm')
-rw-r--r-- | scripts/Dpkg/Control/HashCore.pm | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/Dpkg/Control/HashCore.pm b/scripts/Dpkg/Control/HashCore.pm index f33c15605..a138698a4 100644 --- a/scripts/Dpkg/Control/HashCore.pm +++ b/scripts/Dpkg/Control/HashCore.pm @@ -207,12 +207,14 @@ sub parse { s/\s+$//; next if length == 0 and $paraborder; - next if substr($_, 0, 1) eq '#'; + + my $lead = substr $_, 0, 1; + next if $lead eq '#'; $paraborder = 0; if (m/^(\S+?)\s*:\s*(.*)$/) { $parabody = 1; my ($name, $value) = ($1, $2); - if (substr($name, 0, 1) eq '-') { + if ($lead eq '-') { $self->parse_error($desc, g_('field cannot start with a hyphen')); } if (exists $self->{$name}) { |