mirror of
https://github.com/curl/curl.git
synced 2026-08-10 21:20:54 +03:00
tidy-up: miscellaneous
- avoid "will" in builds scripts, scripts folder, curl_easy_ssls_export.md,
and few other files.
- badwords: add "initialise", "nul terminated", "thread safety" and
variations.
- prefer "null-terminat", where missing (two places).
- fix "null-terminat*" missing dash.
- hostip: merge two `#if` blocks.
- tool_doswin: fix comment
Spotted by GitHub Code Quality
Follow-up to 9a2663322c #17572
- fix stray spaces and newlines.
Closes #21638
This commit is contained in:
parent
47f411c6d8
commit
614b94eecc
64 changed files with 203 additions and 213 deletions
|
|
@ -82,8 +82,8 @@ function(curl_add_runtests _targetname _test_flags)
|
|||
if(_setenvs)
|
||||
set(_setenvs "${CMAKE_COMMAND}" -E env ${_setenvs})
|
||||
endif()
|
||||
# Use a special '$TFLAGS' placeholder as last argument which will be
|
||||
# replaced by the contents of the environment variable in runtests.pl.
|
||||
# Use a special '$TFLAGS' placeholder as last argument which is replaced
|
||||
# by the contents of the environment variable in runtests.pl.
|
||||
# This is a workaround for CMake's limitation where commands executed by
|
||||
# 'make' or 'ninja' cannot portably reference environment variables.
|
||||
string(REPLACE " " ";" _test_flags_list "${_test_flags}")
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
# Lines starting with '#' letters are treated as comments.
|
||||
#
|
||||
# Uses SRP to "a server not supporting it" but modern stunnel versions
|
||||
# will silently accept it and remain happy
|
||||
# silently accept it and remain happy
|
||||
323
|
||||
#
|
||||
594
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ sub parseprotocols {
|
|||
# Generate a "proto-ipv6" version of each protocol to match the
|
||||
# IPv6 <server> name and a "proto-unix" to match the variant which
|
||||
# uses Unix domain sockets. This works even if support is not
|
||||
# compiled in because the <features> test will fail.
|
||||
# compiled in because the <features> test fails.
|
||||
push @protocols, map(("$_-ipv6", "$_-unix"), @protocols);
|
||||
|
||||
# 'http-proxy' is used in test cases to do CONNECT through
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
#
|
||||
# Python3 program to print all combination of size r in an array of size n.
|
||||
# This is used to generate test lines in tests/ech_test.sh.
|
||||
# This will be discarded in the process of moving from experimental,
|
||||
# This is discarded in the process of moving from experimental,
|
||||
# but is worth preserving for the moment in case of changes to the
|
||||
# ECH command line args
|
||||
|
||||
|
|
|
|||
|
|
@ -253,9 +253,9 @@ fi
|
|||
wolf_cnt=$($CURL "${CURL_PARAMS[@]}" -V 2> /dev/null | grep -c wolfSSL)
|
||||
if ((wolf_cnt == 1)); then
|
||||
using_wolf="yes"
|
||||
# for some reason curl+wolfSSL dislikes certs that are ok
|
||||
# for browsers, so we will test using "insecure" mode (-k)
|
||||
# but that is ok here as we are only interested in ECH testing
|
||||
# for some reason curl + wolfSSL dislikes certs that are ok
|
||||
# for browsers, so we test using "insecure" mode (-k)
|
||||
# but that is OK here as we are only interested in ECH testing
|
||||
CURL_PARAMS+=(-k)
|
||||
fi
|
||||
# check if we have dig and it knows https or not
|
||||
|
|
@ -474,7 +474,7 @@ done
|
|||
|
||||
# Check various command line options, if we are good so far
|
||||
if [[ "$using_ossl" == "yes" && "$allgood" == "yes" ]]; then
|
||||
# use this test URL as it will tell us if things worked
|
||||
# use this test URL as it tells us if things worked
|
||||
turl="https://defo.ie/ech-check.php"
|
||||
echo "cli_test with $turl"
|
||||
echo "cli_test with $turl" >> "$logfile"
|
||||
|
|
@ -498,7 +498,7 @@ if [[ "$using_ossl" == "yes" && "$allgood" == "yes" ]]; then
|
|||
# ecl:ecl can be correct, incorrect or missing
|
||||
# ech:pn can be correct, incorrect or missing
|
||||
# in all cases the "last" argument provided should "win"
|
||||
# but only one of hard, true, grease or false will apply
|
||||
# but only one of hard, true, grease or false applies
|
||||
turl="https://defo.ie/ech-check.php"
|
||||
echconfiglist=$(get_ech_configlist defo.ie)
|
||||
goodecl=$echconfiglist
|
||||
|
|
@ -790,7 +790,7 @@ if [[ "$using_ossl" == "yes" && "$allgood" == "yes" ]]; then
|
|||
turl="https://tcd.ie"
|
||||
echo "cli_test with $turl"
|
||||
echo "cli_test with $turl" >> "$logfile"
|
||||
# the params below do not matter much here as we will fail anyway
|
||||
# the params below do not matter much here as we fail anyway
|
||||
echconfiglist=$(get_ech_configlist defo.ie)
|
||||
goodecl=$echconfiglist
|
||||
badecl="$goodecl"
|
||||
|
|
|
|||
|
|
@ -196,9 +196,9 @@ my $TEXT_PASSWORD = "secret";
|
|||
my $POP3_TIMESTAMP = "<1972.987654321\@curl>";
|
||||
|
||||
#**********************************************************************
|
||||
# exit_signal_handler will be triggered to indicate that the program
|
||||
# exit_signal_handler is triggered to indicate that the program
|
||||
# should finish its execution in a controlled way as soon as possible.
|
||||
# For now, program will also terminate from within this handler.
|
||||
# For now, program also terminates from within this handler.
|
||||
#
|
||||
sub exit_signal_handler {
|
||||
my $signame = shift;
|
||||
|
|
@ -227,9 +227,9 @@ sub ftpmsg {
|
|||
}
|
||||
|
||||
#**********************************************************************
|
||||
# eXsysread is a wrapper around perl's sysread() function. This will
|
||||
# repeat the call to sysread() until it has actually read the complete
|
||||
# number of requested bytes or an unrecoverable condition occurs.
|
||||
# eXsysread is a wrapper around perl's sysread() function. This repeats
|
||||
# the call to sysread() until it has actually read the complete number
|
||||
# of requested bytes or an unrecoverable condition occurs.
|
||||
# On success returns a positive value, the number of bytes requested.
|
||||
# On failure or timeout returns zero.
|
||||
#
|
||||
|
|
@ -531,7 +531,7 @@ sub senddata {
|
|||
#**********************************************************************
|
||||
# protocolsetup initializes the 'displaytext' and 'commandfunc' hashes
|
||||
# for the given protocol. References to protocol command callbacks are
|
||||
# stored in 'commandfunc' hash, and text which will be returned to the
|
||||
# stored in 'commandfunc' hash, and text which is returned to the
|
||||
# client before the command callback runs is stored in 'displaytext'.
|
||||
#
|
||||
sub protocolsetup {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ my $trace=0;
|
|||
|
||||
# Normalize the part function arguments for proper caching. This includes the
|
||||
# filename in the arguments since that is an implied parameter that affects the
|
||||
# return value. Any error messages will only be displayed the first time, but
|
||||
# return value. Any error messages are only displayed the first time, but
|
||||
# those are disabled by default anyway, so should never been seen outside
|
||||
# development.
|
||||
sub normalize_part {
|
||||
|
|
@ -195,7 +195,7 @@ sub partexists {
|
|||
}
|
||||
|
||||
# The code currently never calls this more than once per part per file, so
|
||||
# caching a result that will never be used again just slows things down.
|
||||
# caching a result that is never used again just slows things down.
|
||||
# memoize('partexists', NORMALIZER => 'normalize_part'); # cache each result
|
||||
|
||||
sub loadtest {
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ our $pwd = getcwd(); # current working directory
|
|||
our $srcdir = $ENV{'srcdir'} || '.'; # root of the test source code
|
||||
our $perlcmd=shell_quote($^X);
|
||||
our $perl="$perlcmd -I. " . shell_quote("-I$srcdir"); # invoke perl like this
|
||||
our $LOGDIR="log"; # root of the log directory; this will be different for
|
||||
our $LOGDIR="log"; # root of the log directory; this is different for
|
||||
# each runner in multiprocess mode
|
||||
our $LIBDIR=dirsepadd("./libtest/" . ($ENV{'CURL_DIRSUFFIX'} || ''));
|
||||
our $UNITDIR=dirsepadd("./unit/" . ($ENV{'CURL_DIRSUFFIX'} || ''));
|
||||
|
|
|
|||
|
|
@ -169,12 +169,12 @@ static CURLcode test_cli_upload_pausing(const char *URL)
|
|||
/* We want to use our own read function. */
|
||||
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
|
||||
|
||||
/* It will help us to continue the read function. */
|
||||
/* It helps us to continue the read function. */
|
||||
curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, progress_callback);
|
||||
curl_easy_setopt(curl, CURLOPT_XFERINFODATA, curl);
|
||||
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L);
|
||||
|
||||
/* It will help us to ensure that keepalive does not help. */
|
||||
/* It helps us to ensure that keepalive does not help. */
|
||||
curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
|
||||
curl_easy_setopt(curl, CURLOPT_TCP_KEEPIDLE, 1L);
|
||||
curl_easy_setopt(curl, CURLOPT_TCP_KEEPINTVL, 1L);
|
||||
|
|
|
|||
|
|
@ -366,7 +366,7 @@ if($tstunnel_windows) {
|
|||
# Put an "exec" in front of the command so that the child process
|
||||
# keeps this child's process ID by being tied to the spawned shell.
|
||||
exec("exec $cmd") || die "Cannot exec() $cmd: $!";
|
||||
# exec() will create a new process, but ties the existence of the
|
||||
# exec() creates a new process, but ties the existence of the
|
||||
# new process to the parent waiting perl.exe and sh.exe processes.
|
||||
|
||||
# exec() should never return back here to this process. We protect
|
||||
|
|
|
|||
|
|
@ -1348,7 +1348,7 @@ sub runhttpsserver {
|
|||
|
||||
if($httpspid <= 0 || !pidexists($httpspid)) {
|
||||
# it is NOT alive
|
||||
# do not call stopserver since that will also kill the dependent
|
||||
# do not call stopserver since that also kills the dependent
|
||||
# server that has already been started properly
|
||||
$doesntrun{$pidfile} = 1;
|
||||
$httpspid = $pid2 = 0;
|
||||
|
|
@ -1552,7 +1552,7 @@ sub runsecureserver {
|
|||
|
||||
if($protospid <= 0 || !pidexists($protospid)) {
|
||||
# it is NOT alive
|
||||
# do not call stopserver since that will also kill the dependent
|
||||
# do not call stopserver since that also kills the dependent
|
||||
# server that has already been started properly
|
||||
$doesntrun{$pidfile} = 1;
|
||||
$protospid = $pid2 = 0;
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ def smbserver(options):
|
|||
smb_config.set("SERVER", "share type", "0")
|
||||
smb_config.set("SERVER", "path", SERVER_MAGIC)
|
||||
|
||||
# Have a share for tests. These files will be autogenerated from the
|
||||
# Have a share for tests. These files are auto-generated from the
|
||||
# test input.
|
||||
smb_config.add_section("TESTS")
|
||||
smb_config.set("TESTS", "comment", "tests")
|
||||
|
|
@ -146,7 +146,7 @@ def smbserver(options):
|
|||
|
||||
# Start a thread that cleanly shuts down the server on a signal
|
||||
with ShutdownHandler(smb_server):
|
||||
# This will block until smb_server.shutdown() is called
|
||||
# This blocks until smb_server.shutdown() is called
|
||||
smb_server.serve_forever()
|
||||
|
||||
return 0
|
||||
|
|
|
|||
|
|
@ -1186,7 +1186,7 @@ if($sshdid =~ /OpenSSH-Windows/) {
|
|||
# Put an "exec" in front of the command so that the child process
|
||||
# keeps this child's process ID by being tied to the spawned shell.
|
||||
exec("exec $cmd") || die "Cannot exec() $cmd: $!";
|
||||
# exec() will create a new process, but ties the existence of the
|
||||
# exec() creates a new process, but ties the existence of the
|
||||
# new process to the parent waiting perl.exe and sh.exe processes.
|
||||
|
||||
# exec() should never return back here to this process. We protect
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ my @syms;
|
|||
my %doc;
|
||||
my %rem;
|
||||
|
||||
# scanenum runs the preprocessor on curl.h so it will process all enums
|
||||
# scanenum runs the preprocessor on curl.h so it processes all enums
|
||||
# included by it, which *should* be all headers
|
||||
sub scanenum {
|
||||
my ($file) = @_;
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ my @logmessages; # array holding logged messages
|
|||
#
|
||||
# logmsg must only be called by one of the runner_* entry points and functions
|
||||
# called by them, or else logs risk being lost, since those are the only
|
||||
# functions that know about and will return buffered logs.
|
||||
# functions that know about and return buffered logs.
|
||||
sub logmsg {
|
||||
if(!scalar(@_)) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ struct test_1666 {
|
|||
CURLcode result_exp;
|
||||
};
|
||||
|
||||
/* the size of the object needs to deduct the null terminator */
|
||||
/* the size of the object needs to deduct the null-terminator */
|
||||
#define OID(x) x, sizeof(x) - 1
|
||||
|
||||
static bool test1666(const struct test_1666 *spec, size_t i,
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ static bool test1667(const struct test_1667 *spec, size_t i,
|
|||
}
|
||||
else if(!result) {
|
||||
/* use strlen on the pointer instead of curlx_dyn_len() because for some
|
||||
of these type, the code explicitly adds a null terminator which is then
|
||||
of these type, the code explicitly adds a null-terminator which is then
|
||||
counted as buffer size. */
|
||||
size_t actual_len = strlen(curlx_dyn_ptr(dbuf));
|
||||
if(strlen(spec->out) != actual_len) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue