summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2004-12-29 11:29:00 +0000
committerMarc Espie <espie@cvs.openbsd.org>2004-12-29 11:29:00 +0000
commitd76478b24fcdf5f8d37591b1cd2bd6198c2247e6 (patch)
treeecfc60df51b3f040de6f238b01b5dbd48993db58 /usr.sbin/pkg_add
parentea60e7c527df4db7a8c0a98c3835fbfe01063e3e (diff)
remove vreaddir support, since library lookup no longer needs it.
important memory gain, since virtual and virtual_dir account for the lion's share of pkg_add's memory consumption.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Vstat.pm35
1 files changed, 3 insertions, 32 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Vstat.pm b/usr.sbin/pkg_add/OpenBSD/Vstat.pm
index 3dcda0908d2..76949688a31 100644
--- a/usr.sbin/pkg_add/OpenBSD/Vstat.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Vstat.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Vstat.pm,v 1.9 2004/12/17 11:26:22 espie Exp $
+# $OpenBSD: Vstat.pm,v 1.10 2004/12/29 11:28:59 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -26,12 +26,10 @@ use warnings;
package OpenBSD::Vstat;
use File::Basename;
-use Symbol;
my $devinfo = {};
my $devinfo2 = {};
my $virtual = {};
-my $virtual_dir = {};
my $giveup;
sub create_device($)
@@ -127,34 +125,13 @@ sub filestat($)
sub vexists($)
{
my $name = shift;
- if (defined $virtual->{"$name"}) {
- return $virtual->{"$name"};
+ if (defined $virtual->{$name}) {
+ return $virtual->{$name};
} else {
return -e $name;
}
}
-sub vreaddir($)
-{
- my $dirname = shift;
- my %l;
- my $d = gensym;
- opendir($d, $dirname);
- %l = map { $_ => 1 } readdir($d);
- closedir($d);
- if (defined $virtual_dir->{"$dirname"}) {
- for my $e (@{$virtual_dir->{"$dirname"}}) {
- my $n = basename($e);
- if (vexists $e) {
- $l{"$n"} = 1;
- } else {
- undef $l{"$n"};
- }
- }
- }
- return keys(%l);
-}
-
sub account_for($$)
{
my ($name, $size) = @_;
@@ -171,9 +148,6 @@ sub add($$;$)
} else {
$virtual->{$name} = 1;
}
- my $d = dirname($name);
- $virtual_dir->{$d} = [] unless defined $virtual_dir->{$d};
- push(@{$virtual_dir->{$d}}, $name);
return defined($size) ? account_for($name, $size) : undef;
}
@@ -181,9 +155,6 @@ sub remove($$)
{
my ($name, $size) = @_;
$virtual->{$name} = 0;
- my $d = dirname($name);
- $virtual_dir->{$d} = [] unless defined $virtual_dir->{$d};
- push(@{$virtual_dir->{$d}}, $name);
return defined($size) ? account_for($name, -$size) : undef;
}