summaryrefslogtreecommitdiffstats
path: root/perl-install/detect_devices.pm
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2000-11-14 15:31:59 +0000
committerFrancois Pons <fpons@mandriva.com>2000-11-14 15:31:59 +0000
commit949a885497d3d05e4dc0dc20e52ecb758d9b677c (patch)
tree0e7a20d9c3694bc4c392ea420607b7cbacdf3814 /perl-install/detect_devices.pm
parent01975efac2cb7e05fbe05ec3733ae904669a1e94 (diff)
downloaddrakx-949a885497d3d05e4dc0dc20e52ecb758d9b677c.tar
drakx-949a885497d3d05e4dc0dc20e52ecb758d9b677c.tar.gz
drakx-949a885497d3d05e4dc0dc20e52ecb758d9b677c.tar.bz2
drakx-949a885497d3d05e4dc0dc20e52ecb758d9b677c.tar.xz
drakx-949a885497d3d05e4dc0dc20e52ecb758d9b677c.zip
removed foreach (<... which are eating memory
Diffstat (limited to 'perl-install/detect_devices.pm')
-rw-r--r--perl-install/detect_devices.pm24
1 files changed, 12 insertions, 12 deletions
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 (<F>) {
+ local *F; open F, "/proc/scsi/scsi" or return 0;
+ local $_;
+ while (<F>) {
/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 (<F>) { $elem->{$1} = $2 if /(.*):(.*);/ }
+ local *F; open F, "/proc/parport/$_/autoprobe" or next;
+ local $_;
+ while (<F>) { $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 (<F>) {
+ local *F; open F, "/proc/bus/usb/devices" or return;
+ local $_;
+ while (<F>) {
$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 (<F>) {
+ local *F; open F, "serial_probe 2>/dev/null |";
+ local $_;
+ my %current = (); while (<F>) {
$serialprobe{$current{DEVICE}} = { %current } and %current = () if /^\s*$/ && $current{DEVICE};
$current{$1} = $2 if /^([^=]+)=(.*?)\s*$/;
}