From afcf6a400f0d33480b7314fd510c30b934b0f758 Mon Sep 17 00:00:00 2001
From: Thomas Lange <lange@debian.org>
Date: Sat, 12 Aug 2017 03:25:31 +0200
Subject: [PATCH 1/6] optimize code, make debootstrap faster

chomp is not needed, move lc call out of the loop
---
 functions | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/functions b/functions
index 3cfa0d4..5512ab5 100644
--- a/functions
+++ b/functions
@@ -1253,8 +1253,8 @@ if in_path perl; then
 $unique = shift @ARGV; $field = lc(shift @ARGV); $mirror = shift @ARGV;
 %fields = map { $_, 0 } @ARGV;
 $prevpkg = "";
+$chksumfield = lc($ENV{DEBOOTSTRAP_CHECKSUM_FIELD}).":";
 while (<STDIN>) {
-	chomp;
 	next if (/^ /);
 	if (/^([^:]*:)\s*(.*)$/) {
 		$f = lc($1); $v = $2;
@@ -1276,7 +1276,7 @@ while (<STDIN>) {
 		$ver = $v if ($f eq "version:");
 		$arc = $v if ($f eq "architecture:");
 		$fil = $v if ($f eq "filename:");
-		$chk = $v if (lc $f eq lc($ENV{DEBOOTSTRAP_CHECKSUM_FIELD}).":");
+		$chk = $v if ($f eq $chksumfield);
 		$siz = $v if ($f eq "size:");
 		$val = $v if ($f eq $field);
 	} elsif (/^$/) {
@@ -1322,7 +1322,6 @@ while (read STDIN, $x, 1) {
 $prevpkg = "";
 @d = ();
 while (<STDIN>) {
-	chomp;
 	if (/^Package: (.*)$/) {
 		$pkg = $1;
 		if ($pkg ne $prevpkg) {
-- 
2.11.0

