From 949a885497d3d05e4dc0dc20e52ecb758d9b677c Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Tue, 14 Nov 2000 15:31:59 +0000 Subject: removed foreach (<... which are eating memory --- perl-install/detect_devices.pm | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'perl-install/detect_devices.pm') diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index 29356e9b5..79bfedb71 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -75,9 +75,9 @@ sub isUSBFDUDrive { $_[0]->{info} =~ /USB-?FDU/ } sub isRemovableDrive { &isZipDrive || &isLS120Drive || &isUSBFDUDrive } #-or &isJazzDrive } sub hasSCSI() { - local *F; - open F, "/proc/scsi/scsi" or return 0; - foreach () { + local *F; open F, "/proc/scsi/scsi" or return 0; + local $_; + while () { /devices: none/ and log::l("no scsi devices are available"), return 0; } #- log::l("scsi devices are available"); @@ -247,10 +247,10 @@ sub hasUltra66 { sub whatParport() { my @res =(); foreach (0..3) { - local *F; my $elem = {}; - open F, "/proc/parport/$_/autoprobe" or next; - foreach () { $elem->{$1} = $2 if /(.*):(.*);/ } + local *F; open F, "/proc/parport/$_/autoprobe" or next; + local $_; + while () { $elem->{$1} = $2 if /(.*):(.*);/ } push @res, { port => "/dev/lp$_", val => $elem}; } @res; @@ -258,9 +258,9 @@ sub whatParport() { sub whatUsbport() { my ($i, $elem, @res) = (0, {}); - local *F; - open F, "/proc/bus/usb/devices" or return; - foreach () { + local *F; open F, "/proc/bus/usb/devices" or return; + local $_; + while () { $elem->{$1} = $2 if /S:\s+(.*)=(.*\S)/; if (/I:.*Driver=(printer|usblp)/ && $elem->{Manufacturer} && $elem->{Product}) { my $MF = ${{ 'Hewlett-Packard' => 'HP' }}{$elem->{Manufacturer}} || $elem->{Manufacturer}; @@ -303,9 +303,9 @@ sub probeSerialDevices { print STDERR "Please wait while probing serial ports...\n"; #- start probing all serial ports... really faster than before ... #- ... but still take some time :-) - local *F; - open F, "serial_probe 2>/dev/null |"; - my %current = (); foreach () { + local *F; open F, "serial_probe 2>/dev/null |"; + local $_; + my %current = (); while () { $serialprobe{$current{DEVICE}} = { %current } and %current = () if /^\s*$/ && $current{DEVICE}; $current{$1} = $2 if /^([^=]+)=(.*?)\s*$/; } -- cgit v1.2.1