1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-31 17:18:04 +03:00

don't rely on the ability of perl 5.6.x to remove elements from arrays

using delete(). This makes pidl portable back to perl 5.0.
(This used to be commit 9175293535)
This commit is contained in:
Andrew Tridgell 2003-12-16 03:21:34 +00:00
parent 727c3bfdeb
commit 6deece83dc

View File

@ -68,7 +68,10 @@ sub CleanData($)
if (ref($v) eq "ARRAY") {
foreach my $i (0 .. $#{$v}) {
CleanData($v->[$i]);
if (ref($v->[$i]) eq "ARRAY" && $#{$v->[$i]}==-1) { delete($v->[$i]); next; }
if (ref($v->[$i]) eq "ARRAY" && $#{$v->[$i]}==-1) {
$v->[$i] = undef;
next;
}
}
# this removes any undefined elements from the array
@{$v} = grep { defined $_ } @{$v};