tidy-up: miscellaneous

- curl_ntlm_core, smtp, schannel: fix comments.
- curl_setup.h: fix to undef before define.
- tool_doswin, server/sockfilt: reduce variables scopes.
- tool_doswin: drop an interim variable.
- windows: replace `SOCKET_ERROR` with `0` to align with rest of code.
- libssh2: rename variable to align with rest of code.
- gtls, unit1398: use `#if 0`.
- curl_trc.h, curlx/inet_ntop.h: add missing parentheses in macro
  expressions.
- ldap.c: set empty macro to `do {} while(0)`.
- examples/crawler: rename a non-CURLcode `result` variable.
- CURLINFO_TLS_SESSION: drop stray colon.
- add `const` to casts where missing.
- drop unnecessary parentheses.
- fix indent.
- quote style.
- comment style.
- whitespace, newlines, fold/unfold.

Closes #20554
This commit is contained in:
Viktor Szakats 2026-02-01 01:56:43 +01:00
parent 2a92c39a21
commit 61df5f466c
No known key found for this signature in database
88 changed files with 503 additions and 503 deletions

View file

@ -69,7 +69,7 @@ sub outseealso {
my @o;
push @o, ".SH SEE ALSO\n";
for my $s (sort @sa) {
push @o, sprintf "%s.BR $s", $comma ? ",\n": "";
push @o, sprintf "%s.BR $s", $comma ? ",\n" : "";
$comma = 1;
}
push @o, "\n";

View file

@ -89,7 +89,7 @@ sub outseealso {
my @o;
push @o, ".SH SEE ALSO\n";
for my $s (sort @sa) {
push @o, sprintf "%s.BR $s", $comma ? ",\n": "";
push @o, sprintf "%s.BR $s", $comma ? ",\n" : "";
$comma = 1;
}
push @o, "\n";

View file

@ -273,7 +273,7 @@ sub readlocalfile {
sub checkwarn {
my ($name, $num, $col, $file, $line, $msg, $error) = @_;
my $w=$error?"error":"warning";
my $w=$error ? "error" : "warning";
my $nowarn=0;
#if(!$warnings{$name}) {

View file

@ -170,14 +170,14 @@ scanjobs();
print "Used configure options (with / without)\n";
for my $w (sort keys %used) {
printf " %s: %d %d%s\n", $w, $with{$w}, $without{$w},
$defaulton{$w} ? " (auto)":"";
$defaulton{$w} ? " (auto)" : "";
}
print "Never used configure options\n";
for my $w (sort keys %avail) {
if(!$used{$w}) {
printf " %s%s\n", $w,
$defaulton{$w} ? " (auto)":"";
$defaulton{$w} ? " (auto)" : "";
}
}

View file

@ -98,7 +98,7 @@ sub githubactions {
# matrix job
#print "name: $1\n";
$job{'name'} = $1;
$j += ($m?$m:1);
$j += ($m ? $m : 1);
}
elsif($_ =~ /install: (.*)/) {
$job{'install'} = $1;
@ -258,22 +258,22 @@ sub appveyor {
$job{'config'} = $1;
}
elsif($_ =~ /^ OPENSSL: \'(.*)\'/) {
$job{'openssl'} = $1 eq "ON" ? "true": "false";
$job{'openssl'} = $1 eq "ON" ? "true" : "false";
}
elsif($_ =~ /^ SCHANNEL: \'(.*)\'/) {
$job{'schannel'} = $1 eq "ON" ? "true": "false";
$job{'schannel'} = $1 eq "ON" ? "true" : "false";
}
elsif($_ =~ /^ ENABLE_UNICODE: \'(.*)\'/) {
$job{'unicode'} = $1 eq "ON" ? "true": "false";
$job{'unicode'} = $1 eq "ON" ? "true" : "false";
}
elsif($_ =~ /^ HTTP_ONLY: \'(.*)\'/) {
$job{'http-only'} = $1 eq "ON" ? "true": "false";
$job{'http-only'} = $1 eq "ON" ? "true" : "false";
}
elsif($_ =~ /^ TESTING: \'(.*)\'/) {
$job{'testing'} = $1 eq "ON" ? "true": "false";
$job{'testing'} = $1 eq "ON" ? "true" : "false";
}
elsif($_ =~ /^ SHARED: \'(.*)\'/) {
$job{'shared'} = $1 eq "ON" ? "true": "false";
$job{'shared'} = $1 eq "ON" ? "true" : "false";
}
elsif($_ =~ /^ TARGET: \'-A (.*)\'/) {
$job{'target'} = $1;
@ -464,7 +464,7 @@ sub zuul {
$var = "compiler";
}
elsif($var eq "CHECKSRC") {
$job{'checksrc'} = $value ? "true": "false";
$job{'checksrc'} = $value ? "true" : "false";
$var = "";
}
else {

View file

@ -116,7 +116,7 @@ sub justline {
print " ";
$spare--;
}
printf "%s%s", $prev?" ":"", $_;
printf "%s%s", $prev ? " " : "", $_;
$prev = 1;
$spare += $ratio;
}
@ -131,7 +131,7 @@ sub lastline {
prefixline($lvl * $indent + $l);
my $prev = 0;
for(@line) {
printf "%s%s", $prev?" ":"", $_;
printf "%s%s", $prev ? " " : "", $_;
$prev = 1;
}
print "\n";
@ -526,7 +526,7 @@ sub render {
push @desc, "\n" if($blankline && !$header);
$blankline = 0;
push @desc, $d if($manpage);
my $qstr = $quote ? "q": "";
my $qstr = $quote ? "q" : "";
push @desc, "[".(1 + $level)."$qstr]$d" if(!$manpage);
$header = 0;
@ -760,7 +760,7 @@ sub single {
push @leading, "$pref**WARNING**: this option is experimental. Do not use in production.\n\n";
}
my $pre = $manpage ? "\n": "[1]";
my $pre = $manpage ? "\n" : "[1]";
if($scope) {
if($category !~ /global/) {
@ -846,7 +846,7 @@ sub single {
if($and && ($i < $and)) {
$sep = ",";
}
$mstr .= sprintf "%s$l", $mstr?"$sep ":"";
$mstr .= sprintf "%s$l", $mstr ? "$sep " : "";
$i++;
}

View file

@ -166,7 +166,7 @@ sub HELP_MESSAGE() {
print "\t-b\tbackup an existing version of ca-bundle.crt\n";
print "\t-d\tspecify Mozilla tree to pull certdata.txt or custom URL\n";
print "\t\t Valid names are:\n";
print "\t\t ", join( ", ", map { ( $_ =~ m/$opt_d/ ) ? "$_ (default)" : "$_" } sort keys %urls ), "\n";
print "\t\t ", join(", ", map { ($_ =~ m/$opt_d/) ? "$_ (default)" : "$_" } sort keys %urls), "\n";
print "\t-f\tforce rebuild even if certdata.txt is current\n";
print "\t-i\tprint version info about used modules\n";
print "\t-k\tallow URLs other than HTTPS, enable HTTP fallback (insecure)\n";
@ -175,13 +175,13 @@ sub HELP_MESSAGE() {
print "\t-n\tno download of certdata.txt (to use existing)\n";
print wrap("\t","\t\t", "-p\tlist of Mozilla trust purposes and levels for certificates to include in output. Takes the form of a comma separated list of purposes, a colon, and a comma separated list of levels. (default: $default_mozilla_trust_purposes:$default_mozilla_trust_levels)"), "\n";
print "\t\t Valid purposes are:\n";
print wrap("\t\t ","\t\t ", join( ", ", "ALL", @valid_mozilla_trust_purposes ) ), "\n";
print wrap("\t\t ","\t\t ", join(", ", "ALL", @valid_mozilla_trust_purposes)), "\n";
print "\t\t Valid levels are:\n";
print wrap("\t\t ","\t\t ", join( ", ", "ALL", @valid_mozilla_trust_levels ) ), "\n";
print wrap("\t\t ","\t\t ", join(", ", "ALL", @valid_mozilla_trust_levels)), "\n";
print "\t-q\tbe really quiet (no progress output at all)\n";
print wrap("\t","\t\t", "-s\tcomma separated list of certificate signatures/hashes to output in plain text mode. (default: $default_signature_algorithms)\n");
print "\t\t Valid signature algorithms are:\n";
print wrap("\t\t ","\t\t ", join( ", ", "ALL", @valid_signature_algorithms ) ), "\n";
print wrap("\t\t ","\t\t ", join(", ", "ALL", @valid_signature_algorithms)), "\n";
print "\t-t\tinclude plain text listing of certificates\n";
print "\t-u\tunlink (remove) certdata.txt after processing\n";
print "\t-v\tbe verbose and print out processed CAs\n";
@ -193,7 +193,7 @@ sub VERSION_MESSAGE() {
print "${0} version ${version} running Perl ${]} on ${^O}\n";
}
warning_message() unless ($opt_q || $url =~ m/^(ht|f)tps:/i );
warning_message() unless ($opt_q || $url =~ m/^(ht|f)tps:/i);
HELP_MESSAGE() if($opt_h);
sub report($@) {
@ -219,7 +219,7 @@ sub parse_csv_param($$@) {
s/^\s+//; # strip leading spaces
s/\s+$//; # strip trailing spaces
uc $_ # return the modified string as upper case
} split( ',', $param_string );
} split(',', $param_string);
# Find all values which are not in the list of valid values or "ALL"
my @invalid = grep { !is_in_list($_,"ALL",@valid_values) } @values;
@ -227,7 +227,7 @@ sub parse_csv_param($$@) {
if(scalar(@invalid) > 0) {
# Tell the user which parameters were invalid and print the standard help
# message which will exit
print "Error: Invalid ", $description, scalar(@invalid) == 1 ? ": " : "s: ", join( ", ", map { "\"$_\"" } @invalid ), "\n";
print "Error: Invalid ", $description, scalar(@invalid) == 1 ? ": " : "s: ", join(", ", map { "\"$_\"" } @invalid), "\n";
HELP_MESSAGE();
}
@ -272,11 +272,11 @@ if($opt_p !~ m/:/) {
HELP_MESSAGE();
}
(my $included_mozilla_trust_purposes_string, my $included_mozilla_trust_levels_string) = split( ':', $opt_p );
my @included_mozilla_trust_purposes = parse_csv_param( "trust purpose", $included_mozilla_trust_purposes_string, @valid_mozilla_trust_purposes );
my @included_mozilla_trust_levels = parse_csv_param( "trust level", $included_mozilla_trust_levels_string, @valid_mozilla_trust_levels );
(my $included_mozilla_trust_purposes_string, my $included_mozilla_trust_levels_string) = split(':', $opt_p);
my @included_mozilla_trust_purposes = parse_csv_param("trust purpose", $included_mozilla_trust_purposes_string, @valid_mozilla_trust_purposes);
my @included_mozilla_trust_levels = parse_csv_param("trust level", $included_mozilla_trust_levels_string, @valid_mozilla_trust_levels);
my @included_signature_algorithms = parse_csv_param( "signature algorithm", $opt_s, @valid_signature_algorithms );
my @included_signature_algorithms = parse_csv_param("signature algorithm", $opt_s, @valid_signature_algorithms);
sub should_output_cert(%) {
my %trust_purposes_by_level = @_;
@ -284,7 +284,7 @@ sub should_output_cert(%) {
foreach my $level (@included_mozilla_trust_levels) {
# for each level we want to output, see if any of our desired purposes are
# included
return 1 if(defined( List::Util::first { is_in_list( $_, @included_mozilla_trust_purposes ) } @{$trust_purposes_by_level{$level}} ));
return 1 if(defined(List::Util::first { is_in_list($_, @included_mozilla_trust_purposes) } @{$trust_purposes_by_level{$level}}));
}
return 0;
@ -378,7 +378,7 @@ my $datesrc = "as of";
if(!$filedate) {
# mxr.mozilla.org gave us a time, hg.mozilla.org does not!
$filedate = time();
$datesrc="downloaded on";
$datesrc = "downloaded on";
}
# get the hash from the download file

View file

@ -121,7 +121,7 @@ for my $e (sort {$where{$b} <=> $where{$a}} keys %where) {
$showncutoff = 1;
}
printf "%-5d %s%s\n", $where{$e}, $e,
$perm{$e} ? " [ALLOWED]": "";
$perm{$e} ? " [ALLOWED]" : "";
if(!--$top) {
last;
}