lib/optiontable.pl: adapt to CURLOPTDEPRECATED()

Follow-up from 6967571bf2

Reported-by: Gisle Vanem

Fixes #9992
Closes #9993
This commit is contained in:
Daniel Stenberg 2022-11-28 16:32:43 +01:00
Родитель f83610c89d
Коммит ea557cfa27
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 5CC908FDB71E12C2
1 изменённых файлов: 56 добавлений и 24 удалений

Просмотреть файл

@ -37,37 +37,69 @@ HEAD
my $lastnum=0;
sub add {
my($opt, $type, $num)=@_;
my $name;
# remove all spaces from the type
$type =~ s/ //g;
my $ext = $type;
if($opt =~ /OBSOLETE/) {
# skip obsolete options
next;
}
if($opt =~ /^CURLOPT_(.*)/) {
$name=$1;
}
$ext =~ s/CURLOPTTYPE_//;
$ext =~ s/CBPOINT/CBPTR/;
$ext =~ s/POINT\z//;
$type = "CURLOT_$ext";
$opt{$name} = $opt;
$type{$name} = $type;
push @names, $name;
if($num < $lastnum) {
print STDERR "ERROR: $opt has bad number: $num < $lastnum\n";
exit 2;
}
else {
$lastnum = $num;
}
}
my $fl;
while(<STDIN>) {
if(/^ *CURLOPT\(([^,]*), ([^,]*), (\d+)\)/) {
my($opt, $type, $num)=($1,$2,$3);
my $name;
my $ext = $type;
my $l = $_;
if($fl) {
# continued deprecation
if($l =~ /(.*)\),/) {
$fl .= $1;
if($opt =~ /OBSOLETE/) {
# skip obsolete options
next;
}
if($opt =~ /^CURLOPT_(.*)/) {
$name=$1;
}
$ext =~ s/CURLOPTTYPE_//;
$ext =~ s/CBPOINT/CBPTR/;
$ext =~ s/POINT\z//;
$type = "CURLOT_$ext";
$opt{$name} = $opt;
$type{$name} = $type;
push @names, $name;
if($num < $lastnum) {
print STDERR "ERROR: $opt has bad number\n";
exit 2;
# the end
my @p=split(/, */, $fl);
add($p[0], $p[1], $p[2]);
undef $fl;
}
else {
$lastnum = $num;
# another line to append
chomp $l;
$fl .= $l;
}
}
if(/^ *CURLOPTDEPRECATED\((.*)/) {
$fl = $1;
chomp $fl;
}
if(/^ *CURLOPT\(([^,]*), ([^,]*), (\d+)\)/) {
my($opt, $type, $num)=($1,$2,$3);
add($opt, $type, $num);
}
# alias for an older option
# old = new
if(/^#define (CURLOPT_[^ ]*) *(CURLOPT_\S*)/) {