tidy-up: miscellaneous

- tool_bname: scope an include.
- `endif` comments.
- Markdown fixes.
- comment tidy-ups.
- whitespace, newlines, indent.

Closes #20309
This commit is contained in:
Viktor Szakats 2026-01-02 01:34:05 +01:00
parent 62ba3604dc
commit ac6264366f
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
98 changed files with 829 additions and 863 deletions

View file

@ -55,7 +55,7 @@ static int get_address_family(curl_socket_t sockfd)
#endif
#ifndef SOL_IP
# define SOL_IP IPPROTO_IP
#define SOL_IP IPPROTO_IP
#endif
#if defined(IP_TOS) || defined(IPV6_TCLASS) || defined(SO_PRIORITY)

View file

@ -23,10 +23,10 @@
***************************************************************************/
#include "tool_setup.h"
#include "tool_bname.h"
#ifndef HAVE_BASENAME
#include "tool_bname.h"
char *tool_basename(char *path)
{
char *s1;

View file

@ -143,7 +143,7 @@ locdone:
curlx_free(copyloc);
}
}
#endif
#endif /* LINK */
/*
* Copies a filename part and returns an ALLOCATED data buffer.

View file

@ -35,7 +35,7 @@
my $pi = 3.1415;
foreach my $i (1 .. 200) {
printf "%d, ", sin($i/200 * 2 * $pi) * 500000 + 500000;
printf "%d, ", sin($i / 200 * 2 * $pi) * 500000 + 500000;
}
*/
static const int sinus[] = {

View file

@ -130,7 +130,7 @@ size_t tool_read_cb(char *buffer, size_t sz, size_t nmemb, void *userdata)
#endif
}
else
#endif
#endif /* _WIN32 */
{
rc = read(per->infd, buffer, sz * nmemb);
if(rc < 0) {

View file

@ -28,7 +28,6 @@
/*
** callback for CURLOPT_SEEKFUNCTION
*/
int tool_seek_cb(void *userdata, curl_off_t offset, int whence);
#endif /* HEADER_CURL_TOOL_CB_SEE_H */

View file

@ -231,7 +231,7 @@ static size_t win_console(intptr_t fhnd, struct OutStruct *outs,
*retp = bytes;
return 0;
}
#endif
#endif /* _WIN32 */
/*
** callback for CURLOPT_WRITEFUNCTION
@ -303,7 +303,7 @@ size_t tool_write_cb(char *buffer, size_t sz, size_t nmemb, void *userdata)
return CURL_WRITEFUNC_ERROR;
}
}
#endif
#endif /* DEBUGBUILD */
if(!outs->stream && !tool_create_output_file(outs, per->config))
return CURL_WRITEFUNC_ERROR;

View file

@ -120,7 +120,7 @@ static void free_config_fields(struct OperationConfig *config)
#ifndef CURL_DISABLE_IPFS
tool_safefree(config->ipfs_gateway);
#endif /* !CURL_DISABLE_IPFS */
#endif
tool_safefree(config->doh_url);
tool_safefree(config->cipher_list);
tool_safefree(config->proxy_cipher_list);

View file

@ -107,7 +107,7 @@ struct OperationConfig {
size_t num_urls; /* number of URLs added to the list */
#ifndef CURL_DISABLE_IPFS
char *ipfs_gateway;
#endif /* !CURL_DISABLE_IPFS */
#endif
char *doh_url;
char *cipher_list;
char *proxy_cipher_list;

View file

@ -145,6 +145,6 @@ char *findfile(const char *fname, int dotscore)
return checkhome(home, fname, FALSE);
}
}
#endif /* PWD-stuff */
#endif /* HAVE_GETPWUID && HAVE_GETEUID */
return NULL;
}

View file

@ -182,7 +182,7 @@ static const struct LongShort aliases[]= {
{"ip-tos", ARG_STRG, ' ', C_IP_TOS},
#ifndef CURL_DISABLE_IPFS
{"ipfs-gateway", ARG_STRG, ' ', C_IPFS_GATEWAY},
#endif /* !CURL_DISABLE_IPFS */
#endif
{"ipv4", ARG_NONE, '4', C_IPV4},
{"ipv6", ARG_NONE, '6', C_IPV6},
{"json", ARG_STRG, ' ', C_JSON},
@ -2388,7 +2388,7 @@ static ParameterError opt_string(struct OperationConfig *config,
case C_IPFS_GATEWAY: /* --ipfs-gateway */
err = getstr(&config->ipfs_gateway, nextarg, DENY_BLANK);
break;
#endif /* !CURL_DISABLE_IPFS */
#endif
case C_AWS_SIGV4: /* --aws-sigv4 */
config->authtype |= CURLAUTH_AWS_SIGV4;
err = getstr(&config->aws_sigv4, nextarg, ALLOW_BLANK);

View file

@ -58,11 +58,11 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
long sts;
short chan;
/* iosbdef.h was not in VAX V7.2 or CC 6.4 */
/* iosbdef.h was not in VAX V7.2 or CC 6.4 */
struct _isb {
short int iosb$w_status; /* status */
short int iosb$w_status; /* status */
short int iosb$w_bcnt; /* byte count */
int unused; /* unused */
int unused; /* unused */
} iosb;
$DESCRIPTOR(ttdesc, "TT");
@ -86,7 +86,6 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
#endif /* __VMS */
#ifdef _WIN32
char *getpass_r(const char *prompt, char *buffer, size_t buflen)
{
size_t i;
@ -100,7 +99,7 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
}
else if(buffer[i] == '\b')
/* remove this letter and if this is not the first key, remove the
previous one as well */
previous one as well */
i = i - (i >= 1 ? 2 : 1);
}
/* since echo is disabled, print a newline */

View file

@ -54,8 +54,8 @@ struct helptxt {
};
/*
* The bitmask output is generated with the following command
------------------------------------------------------------
The bitmask output is generated with the following command:
------------------------------------------------------------
make -C docs/cmdline-opts listcats
*/

View file

@ -46,7 +46,7 @@ const char *proto_tftp = NULL;
#ifndef CURL_DISABLE_IPFS
const char *proto_ipfs = "ipfs";
const char *proto_ipns = "ipns";
#endif /* !CURL_DISABLE_IPFS */
#endif
static struct proto_name_tokenp {
const char *proto_name;

View file

@ -207,4 +207,4 @@ int main(int argc, char *argv[])
#endif
#endif
#endif /* ndef UNITTESTS */
#endif /* !UNITTESTS */

View file

@ -40,7 +40,6 @@ void progress_finalize(struct per_transfer *per);
#ifdef UNITTESTS
UNITTEST char *max5data(curl_off_t bytes, char *max5, size_t mlen);
UNITTEST void time2str(char *r, size_t rlen, curl_off_t seconds);
#endif
#endif /* HEADER_CURL_TOOL_PROGRESS_H */

View file

@ -61,7 +61,6 @@
* 'utf8seq' member holds an incomplete UTF-8 sequence destined for the console
* until it can be completed (1-4 bytes) + NUL.
*/
struct OutStruct {
char *filename;
FILE *stream;
@ -82,7 +81,6 @@ struct OutStruct {
* as well as information relative to where URL contents should
* be stored or which file should be uploaded.
*/
struct getout {
struct getout *next; /* next one */
char *url; /* the URL we deal with */
@ -98,10 +96,10 @@ struct getout {
BIT(noglob); /* disable globbing for this URL */
BIT(out_null); /* discard output for this URL */
};
/*
* 'trace' enumeration represents curl's output look'n feel possibilities.
*/
typedef enum {
TRACE_NONE, /* no trace/verbose output at all */
TRACE_BIN, /* tcpdump inspired look */
@ -112,7 +110,6 @@ typedef enum {
/*
* 'HttpReq' enumeration represents HTTP request types.
*/
typedef enum {
TOOL_HTTPREQ_UNSPEC, /* first in list */
TOOL_HTTPREQ_GET,
@ -134,7 +131,6 @@ typedef enum {
* Complete struct declarations which have OperationConfig struct members,
* just in case this header is directly included in some source file.
*/
#include "tool_cfgable.h"
#endif /* HEADER_CURL_TOOL_SDECLS_H */