summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2003-05-19 14:17:58 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2003-05-19 14:17:58 +0000
commitdc0e920f7191063467752a4a31e6a14c1ad9fe29 (patch)
tree485a936987958a2f763f9794c126f85dc9c009d2 /perl-install
parent6e555c9eab6165f0794e4b43a322a51b201813c3 (diff)
downloaddrakx-dc0e920f7191063467752a4a31e6a14c1ad9fe29.tar
drakx-dc0e920f7191063467752a4a31e6a14c1ad9fe29.tar.gz
drakx-dc0e920f7191063467752a4a31e6a14c1ad9fe29.tar.bz2
drakx-dc0e920f7191063467752a4a31e6a14c1ad9fe29.tar.xz
drakx-dc0e920f7191063467752a4a31e6a14c1ad9fe29.zip
- (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
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/printer/main.pm8
1 files 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*<Location\s+$path\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, "<Location $path>\n";
- push @location, "</Location>\n";
+ @location = ("<Location $path>\n", "</Location>\n");
}
return ($location_start, @location);