diff options
author | Daniel Stenberg <daniel@haxx.se> | 2020-05-14 00:05:04 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2020-05-15 08:54:42 +0200 |
commit | 8df455479f8801bbebad8839fc96abbffa711603 (patch) | |
tree | ad0fcac278779ef75726f8aec6a061453c043282 /tests/libtest | |
parent | 5d54b5e6971cf26b35d11980d6953bf436419752 (diff) | |
download | curl-8df455479f8801bbebad8839fc96abbffa711603.tar.gz |
source cleanup: remove all custom typedef structs
- Stick to a single unified way to use structs
- Make checksrc complain on 'typedef struct {'
- Allow them in tests, public headers and examples
- Let MD4_CTX, MD5_CTX, and SHA256_CTX typedefs remain as they actually
typedef different types/structs depending on build conditions.
Closes #5338
Diffstat (limited to 'tests/libtest')
-rw-r--r-- | tests/libtest/.checksrc | 1 | ||||
-rw-r--r-- | tests/libtest/Makefile.am | 2 | ||||
-rw-r--r-- | tests/libtest/lib1156.c | 10 | ||||
-rw-r--r-- | tests/libtest/lib576.c | 12 |
4 files changed, 13 insertions, 12 deletions
diff --git a/tests/libtest/.checksrc b/tests/libtest/.checksrc new file mode 100644 index 000000000..24677d53e --- /dev/null +++ b/tests/libtest/.checksrc @@ -0,0 +1 @@ +disable TYPEDEFSTRUCT diff --git a/tests/libtest/Makefile.am b/tests/libtest/Makefile.am index 67a20cb98..e87a36306 100644 --- a/tests/libtest/Makefile.am +++ b/tests/libtest/Makefile.am @@ -5,7 +5,7 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al. +# Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms diff --git a/tests/libtest/lib1156.c b/tests/libtest/lib1156.c index df6062c56..ff94d9cfd 100644 --- a/tests/libtest/lib1156.c +++ b/tests/libtest/lib1156.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -40,12 +40,12 @@ #define F_CONTENTRANGE (1 << 3) /* Server sends content-range hdr. */ #define F_IGNOREBODY (1 << 4) /* Body should be ignored. */ -typedef struct { +struct testparams { unsigned int flags; /* ORed flags as above. */ CURLcode result; /* Code that should be returned by curl_easy_perform(). */ -} testparams; +}; -static const testparams params[] = { +static const struct testparams params[] = { { 0, CURLE_OK }, { F_CONTENTRANGE, CURLE_OK }, { F_FAIL, CURLE_OK }, @@ -82,7 +82,7 @@ static size_t writedata(char *data, size_t size, size_t nmemb, void *userdata) return size * nmemb; } -static int onetest(CURL *curl, const char *url, const testparams *p) +static int onetest(CURL *curl, const char *url, const struct testparams *p) { CURLcode res; unsigned int replyselector; diff --git a/tests/libtest/lib576.c b/tests/libtest/lib576.c index 3b9a9001d..f66825895 100644 --- a/tests/libtest/lib576.c +++ b/tests/libtest/lib576.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -24,10 +24,10 @@ #include "testutil.h" #include "memdebug.h" -typedef struct { +struct chunk_data { int remains; int print_content; -} chunk_data_t; +}; static long chunk_bgn(const struct curl_fileinfo *finfo, void *ptr, int remains); @@ -37,7 +37,7 @@ long chunk_end(void *ptr); static long chunk_bgn(const struct curl_fileinfo *finfo, void *ptr, int remains) { - chunk_data_t *ch_d = ptr; + struct chunk_data *ch_d = ptr; ch_d->remains = remains; printf("=============================================================\n"); @@ -87,7 +87,7 @@ long chunk_bgn(const struct curl_fileinfo *finfo, void *ptr, int remains) static long chunk_end(void *ptr) { - chunk_data_t *ch_d = ptr; + struct chunk_data *ch_d = ptr; if(ch_d->print_content) { ch_d->print_content = 0; printf("-------------------------------------------------------------\n"); @@ -101,7 +101,7 @@ int test(char *URL) { CURL *handle = NULL; CURLcode res = CURLE_OK; - chunk_data_t chunk_data = {0, 0}; + struct chunk_data chunk_data = {0, 0}; curl_global_init(CURL_GLOBAL_ALL); handle = curl_easy_init(); if(!handle) { |