mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:21:41 +03:00
tidy-up: miscellaneous
- apply more clang-format. - lib/version: use `CURL_ARRAYSIZE()`. - INSTALL-CMAKE.md: sync-up an option description with others. - examples: delete unused main args. - examples/ftpgetinfo: document `_CRT_SECURE_NO_WARNINGS` symbol. - delete remaining stray duplicate lines. - acinclude.m4: drop an unnecessary x-hack. - vtls/mbedtls: join a URL split into two lines. - src/tool_cb_see: add parentheses around macro expressions. - src/tool_operate: move literals to the right side of comparisons. - libtests: sync up fopen/fstat error messages between tests. - curl_setup.h: replace `if ! defined __LP64` with `ifndef __LP64`. I assume it makes no difference on Tandem systems, as the latter form is already used in `include/curl/system.h`. Closes #20018
This commit is contained in:
parent
cd9da30e76
commit
308c347c8b
53 changed files with 988 additions and 1005 deletions
|
|
@ -162,7 +162,7 @@
|
|||
|
||||
/* ================================================================ */
|
||||
/* Definition of preprocessor macros/symbols which modify compiler */
|
||||
/* behavior or generated code characteristics must be done here, */
|
||||
/* behavior or generated code characteristics must be done here, */
|
||||
/* as appropriate, before any system header file is included. It is */
|
||||
/* also possible to have them defined in the config file included */
|
||||
/* before this point. As a result of all this we frown inclusion of */
|
||||
|
|
@ -449,7 +449,7 @@
|
|||
#include <assert.h>
|
||||
|
||||
#ifdef __TANDEM /* for ns*-tandem-nsk systems */
|
||||
# if ! defined __LP64
|
||||
# ifndef __LP64
|
||||
# include <floss.h> /* FLOSS is only used for 32-bit builds. */
|
||||
# endif
|
||||
#endif
|
||||
|
|
@ -783,7 +783,7 @@
|
|||
* Definition of our NOP statement Object-like macro
|
||||
*/
|
||||
#ifndef Curl_nop_stmt
|
||||
#define Curl_nop_stmt do { } while(0)
|
||||
#define Curl_nop_stmt do {} while(0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -843,8 +843,8 @@
|
|||
Therefore we specify it explicitly. https://github.com/curl/curl/pull/258
|
||||
*/
|
||||
#if defined(_WIN32) || defined(MSDOS)
|
||||
#define FOPEN_READTEXT "rt"
|
||||
#define FOPEN_WRITETEXT "wt"
|
||||
#define FOPEN_READTEXT "rt"
|
||||
#define FOPEN_WRITETEXT "wt"
|
||||
#define FOPEN_APPENDTEXT "at"
|
||||
#elif defined(__CYGWIN__)
|
||||
/* Cygwin has specific behavior we need to address when _WIN32 is not defined.
|
||||
|
|
@ -853,12 +853,12 @@ For write we want our output to have line endings of LF and be compatible with
|
|||
other Cygwin utilities. For read we want to handle input that may have line
|
||||
endings either CRLF or LF so 't' is appropriate.
|
||||
*/
|
||||
#define FOPEN_READTEXT "rt"
|
||||
#define FOPEN_WRITETEXT "w"
|
||||
#define FOPEN_READTEXT "rt"
|
||||
#define FOPEN_WRITETEXT "w"
|
||||
#define FOPEN_APPENDTEXT "a"
|
||||
#else
|
||||
#define FOPEN_READTEXT "r"
|
||||
#define FOPEN_WRITETEXT "w"
|
||||
#define FOPEN_READTEXT "r"
|
||||
#define FOPEN_WRITETEXT "w"
|
||||
#define FOPEN_APPENDTEXT "a"
|
||||
#endif
|
||||
|
||||
|
|
@ -919,7 +919,10 @@ extern curl_calloc_callback Curl_ccalloc;
|
|||
* This macro also assigns NULL to given pointer when free'd.
|
||||
*/
|
||||
#define Curl_safefree(ptr) \
|
||||
do { curlx_free(ptr); (ptr) = NULL;} while(0)
|
||||
do { \
|
||||
curlx_free(ptr); \
|
||||
(ptr) = NULL; \
|
||||
} while(0)
|
||||
|
||||
#include <curl/curl.h> /* for CURL_EXTERN, mprintf.h */
|
||||
|
||||
|
|
@ -1002,15 +1005,13 @@ CURL_EXTERN RECV_TYPE_RETV curl_dbg_recv(RECV_TYPE_ARG1 sockfd,
|
|||
|
||||
/* FILE functions */
|
||||
CURL_EXTERN int curl_dbg_fclose(FILE *file, int line, const char *source);
|
||||
CURL_EXTERN ALLOC_FUNC
|
||||
FILE *curl_dbg_fopen(const char *file, const char *mode,
|
||||
int line, const char *source);
|
||||
CURL_EXTERN ALLOC_FUNC
|
||||
FILE *curl_dbg_freopen(const char *file, const char *mode, FILE *fh,
|
||||
int line, const char *source);
|
||||
CURL_EXTERN ALLOC_FUNC
|
||||
FILE *curl_dbg_fdopen(int filedes, const char *mode,
|
||||
int line, const char *source);
|
||||
CURL_EXTERN ALLOC_FUNC FILE *curl_dbg_fopen(const char *file, const char *mode,
|
||||
int line, const char *source);
|
||||
CURL_EXTERN ALLOC_FUNC FILE *curl_dbg_freopen(const char *file,
|
||||
const char *mode, FILE *fh,
|
||||
int line, const char *source);
|
||||
CURL_EXTERN ALLOC_FUNC FILE *curl_dbg_fdopen(int filedes, const char *mode,
|
||||
int line, const char *source);
|
||||
|
||||
#define sclose(sockfd) curl_dbg_sclose(sockfd, __LINE__, __FILE__)
|
||||
#define fake_sclose(sockfd) curl_dbg_mark_sclose(sockfd, __LINE__, __FILE__)
|
||||
|
|
@ -1059,47 +1060,47 @@ CURL_EXTERN ALLOC_FUNC
|
|||
|
||||
#ifdef CURLDEBUG
|
||||
|
||||
#define curlx_strdup(ptr) curl_dbg_strdup(ptr, __LINE__, __FILE__)
|
||||
#define curlx_malloc(size) curl_dbg_malloc(size, __LINE__, __FILE__)
|
||||
#define curlx_calloc(nbelem,size) \
|
||||
curl_dbg_calloc(nbelem, size, __LINE__, __FILE__)
|
||||
#define curlx_realloc(ptr,size) \
|
||||
curl_dbg_realloc(ptr, size, __LINE__, __FILE__)
|
||||
#define curlx_free(ptr) curl_dbg_free(ptr, __LINE__, __FILE__)
|
||||
#define curlx_strdup(ptr) curl_dbg_strdup(ptr, __LINE__, __FILE__)
|
||||
#define curlx_malloc(size) curl_dbg_malloc(size, __LINE__, __FILE__)
|
||||
#define curlx_calloc(nbelem, size) \
|
||||
curl_dbg_calloc(nbelem, size, __LINE__, __FILE__)
|
||||
#define curlx_realloc(ptr, size) \
|
||||
curl_dbg_realloc(ptr, size, __LINE__, __FILE__)
|
||||
#define curlx_free(ptr) curl_dbg_free(ptr, __LINE__, __FILE__)
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef UNICODE
|
||||
#define curlx_tcsdup(ptr) curl_dbg_wcsdup(ptr, __LINE__, __FILE__)
|
||||
#define curlx_tcsdup(ptr) curl_dbg_wcsdup(ptr, __LINE__, __FILE__)
|
||||
#else
|
||||
#define curlx_tcsdup(ptr) curlx_strdup(ptr)
|
||||
#define curlx_tcsdup(ptr) curlx_strdup(ptr)
|
||||
#endif
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#else /* !CURLDEBUG */
|
||||
|
||||
#ifdef BUILDING_LIBCURL
|
||||
#define curlx_strdup(ptr) Curl_cstrdup(ptr)
|
||||
#define curlx_malloc(size) Curl_cmalloc(size)
|
||||
#define curlx_calloc(nbelem,size) Curl_ccalloc(nbelem, size)
|
||||
#define curlx_realloc(ptr,size) Curl_crealloc(ptr, size)
|
||||
#define curlx_free(ptr) Curl_cfree(ptr)
|
||||
#define curlx_strdup(ptr) Curl_cstrdup(ptr)
|
||||
#define curlx_malloc(size) Curl_cmalloc(size)
|
||||
#define curlx_calloc(nbelem, size) Curl_ccalloc(nbelem, size)
|
||||
#define curlx_realloc(ptr, size) Curl_crealloc(ptr, size)
|
||||
#define curlx_free(ptr) Curl_cfree(ptr)
|
||||
#else /* !BUILDING_LIBCURL */
|
||||
#ifdef _WIN32
|
||||
#define curlx_strdup(ptr) _strdup(ptr)
|
||||
#define curlx_strdup(ptr) _strdup(ptr)
|
||||
#else
|
||||
#define curlx_strdup(ptr) strdup(ptr)
|
||||
#define curlx_strdup(ptr) strdup(ptr)
|
||||
#endif
|
||||
#define curlx_malloc(size) malloc(size)
|
||||
#define curlx_calloc(nbelem,size) calloc(nbelem, size)
|
||||
#define curlx_realloc(ptr,size) realloc(ptr, size)
|
||||
#define curlx_free(ptr) free(ptr)
|
||||
#define curlx_malloc(size) malloc(size)
|
||||
#define curlx_calloc(nbelem, size) calloc(nbelem, size)
|
||||
#define curlx_realloc(ptr, size) realloc(ptr, size)
|
||||
#define curlx_free(ptr) free(ptr)
|
||||
#endif /* BUILDING_LIBCURL */
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef UNICODE
|
||||
#define curlx_tcsdup(ptr) Curl_wcsdup(ptr)
|
||||
#define curlx_tcsdup(ptr) Curl_wcsdup(ptr)
|
||||
#else
|
||||
#define curlx_tcsdup(ptr) curlx_strdup(ptr)
|
||||
#define curlx_tcsdup(ptr) curlx_strdup(ptr)
|
||||
#endif
|
||||
#endif /* _WIN32 */
|
||||
|
||||
|
|
@ -1124,8 +1125,8 @@ int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf,
|
|||
#endif
|
||||
|
||||
#if (defined(USE_NGTCP2) && defined(USE_NGHTTP3)) || \
|
||||
(defined(USE_OPENSSL_QUIC) && defined(USE_NGHTTP3)) || \
|
||||
defined(USE_QUICHE)
|
||||
(defined(USE_OPENSSL_QUIC) && defined(USE_NGHTTP3)) || \
|
||||
defined(USE_QUICHE)
|
||||
|
||||
#ifdef CURL_WITH_MULTI_SSL
|
||||
#error "MultiSSL combined with QUIC is not supported"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue