mirror of
https://github.com/curl/curl.git
synced 2026-08-25 02:03:36 +03:00
tidy-up: C and CI
- drop redundant casts for `CURL_UNCONST()` pointers (Windows). - GHA/linux: delete redundant/dupe `-g` C flag in memory sanitizer job. Spotted-by: Daniel Stenberg - examples/http2-upload: drop local macro. - examples/http2-upload: drop leading underscore from union name. - examples/http2-upload: drop interim macro. - tests/server/util: reapply patch lost in a rebase. - sync `main()` declarations across the codebase. Closes #22559
This commit is contained in:
parent
35843dd635
commit
8a8ff47b63
37 changed files with 59 additions and 68 deletions
|
|
@ -88,7 +88,7 @@ static size_t read_cb(char *ptr, size_t size, size_t nmemb, void *stream)
|
|||
return nread;
|
||||
}
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode result;
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ static size_t write_cb(char *buff, size_t size, size_t nmemb, void *cb_data)
|
|||
return written;
|
||||
}
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
/* curl easy handle */
|
||||
CURL *curl;
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ static void dumpNode(TidyDoc doc, TidyNode tnod, int indent)
|
|||
}
|
||||
}
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
CURL *curl;
|
||||
char curl_errbuf[CURL_ERROR_SIZE];
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ static int setup(struct transfer *t, int num)
|
|||
/*
|
||||
* Download many transfers over HTTP/2, using the same connection!
|
||||
*/
|
||||
int main(int argc, const char **argv)
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
CURLcode result;
|
||||
struct transfer *trans;
|
||||
|
|
|
|||
|
|
@ -67,20 +67,18 @@
|
|||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define gettimeofday(a, b) my_gettimeofday(a, b)
|
||||
static int my_gettimeofday(struct timeval *tp, void *tzp)
|
||||
static int gettimeofday(struct timeval *tp, void *tzp)
|
||||
{
|
||||
(void)tzp;
|
||||
if(tp) {
|
||||
/* Offset between 1601-01-01 and 1970-01-01 in 100 nanosec units */
|
||||
#define WIN32_FT_OFFSET 116444736000000000
|
||||
union {
|
||||
CURL_TYPEOF_CURL_OFF_T ns100; /* time since 1 Jan 1601 in 100ns units */
|
||||
FILETIME ft;
|
||||
} _now;
|
||||
GetSystemTimeAsFileTime(&_now.ft);
|
||||
tp->tv_usec = (long)((_now.ns100 / 10) % 1000000);
|
||||
tp->tv_sec = (long)((_now.ns100 - WIN32_FT_OFFSET) / 10000000);
|
||||
} now;
|
||||
GetSystemTimeAsFileTime(&now.ft);
|
||||
tp->tv_usec = (long)((now.ns100 / 10) % 1000000);
|
||||
/* subtract offset between 1601-01-01 and 1970-01-01 in 100ns units */
|
||||
tp->tv_sec = (long)((now.ns100 - 116444736000000000) / 10000000);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -286,7 +284,7 @@ static int setup(struct input *t, int num, const char *upload)
|
|||
/*
|
||||
* Upload all files over HTTP/2, using the same physical connection!
|
||||
*/
|
||||
int main(int argc, const char **argv)
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
CURLcode result;
|
||||
struct input *trans;
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ static const char olivertwist[] =
|
|||
* CURLOPT_POSTFIELDS to the URL given as an argument.
|
||||
*/
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode result;
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ static size_t read_cb(char *ptr, size_t size, size_t nmemb, void *stream)
|
|||
return retcode;
|
||||
}
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode result;
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ static int handle_socket(CURL *curl, curl_socket_t s, int action, void *userp,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
CURLcode result;
|
||||
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ static int cb_socket(CURL *curl, curl_socket_t s, int action,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
CURLcode result;
|
||||
struct datauv uv = { 0 };
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ static gboolean cb_delete(GtkWidget *window, gpointer data)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
GtkWidget *top_window, *outside_frame, *inside_frame, *progress_bar;
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
* **** This example only works with libcurl 7.56.0 and later! ****
|
||||
*/
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
const char *name = argc > 1 ? argv[1] : "openssl";
|
||||
CURLsslset result;
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ if(!x)
|
|||
For functions the opening brace should be on a separate line:
|
||||
|
||||
```c
|
||||
int main(int argc, char **argv)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ string comparison functions. This function works on all platforms.
|
|||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(int argc, char **argv)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
const char *name = "compare";
|
||||
if(curl_strequal(name, argv[1]))
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ string comparison functions. This function works on all platforms.
|
|||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(int argc, char **argv)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
const char *name = "compare";
|
||||
if(curl_strnequal(name, argv[1], 5))
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ static size_t wf(char *ptr, size_t size, size_t nmemb, void *stream)
|
|||
return size * nmemb;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
CURLcode result;
|
||||
curl = curl_easy_init();
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ All protocols built-in.
|
|||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(int argc, char **argv)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ All protocols built-in
|
|||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(int argc, char **argv)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ size_t read_callback(char *ptr, size_t size, size_t nmemb, void *userdata)
|
|||
return retcode;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
FILE *file = fopen(argv[1], "rb");
|
||||
CURLcode result;
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ HTTP, HTTPS, FTP and FTPS
|
|||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(int argc, char **argv)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ HTTP, HTTPS, FTP and FTPS
|
|||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
int main(int argc, char **argv)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue