From dc0e920f7191063467752a4a31e6a14c1ad9fe29 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Mon, 19 May 2003 14:17:58 +0000 Subject: - (read_location, rip_location): simplify loop condition since once we get $location_end, we exit it - (rip_location): simplify @location build when no existing one --- perl-install/printer/main.pm | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/perl-install/printer/main.pm b/perl-install/printer/main.pm index 6e70dfaad..bdd4e52da 100644 --- a/perl-install/printer/main.pm +++ b/perl-install/printer/main.pm @@ -664,7 +664,7 @@ sub read_location { my $location_end = -1; # Go through all the lines, bail out when start and end line found for (my $i = 0; - $i <= $#{$cupsd_conf_ptr} and $location_end == -1; + $i <= $#{$cupsd_conf_ptr}; $i++) { if ($cupsd_conf_ptr->[$i] =~ m!^\s*<\s*Location\s+$path\s*>!) { # Start line of block @@ -707,7 +707,7 @@ sub rip_location { if (grep { m!^\s*! } @$cupsd_conf_ptr) { # Go through all the lines, bail out when start and end line found for (my $i = 0; - $i <= $#{$cupsd_conf_ptr} and $location_end == -1; + $i <= $#{$cupsd_conf_ptr} == -1; $i++) { if ($cupsd_conf_ptr->[$i] =~ m!^\s*<\s*Location\s+$path\s*>!) { # Start line of block @@ -727,9 +727,7 @@ sub rip_location { } else { # If there is no location block, create one $location_start = $#{$cupsd_conf_ptr} + 1; - @location = (); - push @location, "\n"; - push @location, "\n"; + @location = ("\n", "\n"); } return ($location_start, @location); -- cgit v1.2.1