Fix Perl deprecation warnings.

Use of defined on aggregates (hashes and arrays) is deprecated.
You should instead use a simple test for size.
This commit is contained in:
Victor van den Elzen 2010-11-07 17:20:23 +01:00
parent af43b97514
commit bc8522e3a0
5 changed files with 5 additions and 5 deletions

View file

@ -95,7 +95,7 @@ if ($output eq 'h') {
}
@hashinfo = gen_perfect_hash(\%directive);
if (!defined(@hashinfo)) {
if (!@hashinfo) {
die "$0: no hash found\n";
}

View file

@ -161,7 +161,7 @@ sub gen_perfect_hash($) {
for ($j = 0; $j < $maxj; $j++) {
$sv = $random_sv_vectors[$j];
@hashinfo = gen_hash_n($n, $sv, $href, $run++);
return @hashinfo if (defined(@hashinfo));
return @hashinfo if (@hashinfo);
}
$n <<= 1;
}

View file

@ -75,7 +75,7 @@ sub main() {
%data = read_input();
@hashinfo = gen_perfect_hash(\%data);
if (!defined(@hashinfo)) {
if (!@hashinfo) {
die "$0: no hash found\n";
}

View file

@ -164,7 +164,7 @@ if ($what eq 'c') {
}
my @hashinfo = gen_perfect_hash(\%tokens);
if (!defined(@hashinfo)) {
if (!@hashinfo) {
die "$0: no hash found\n";
}

View file

@ -183,7 +183,7 @@ if ($output eq 'h') {
#
@hashinfo = gen_perfect_hash(\%tokens);
if (!defined(@hashinfo)) {
if (!@hashinfo) {
die "$0: no hash found\n";
}