diff options
author | Alexander Smirnov <alex@ydb.tech> | 2024-10-16 12:11:24 +0000 |
---|---|---|
committer | Alexander Smirnov <alex@ydb.tech> | 2024-10-16 12:11:24 +0000 |
commit | 40811e93f3fdf9342a9295369994012420fac548 (patch) | |
tree | a8d85e094a9c21e10aa250f537c101fc2016a049 /contrib/libs/curl/lib/curl_trc.h | |
parent | 30ebe5357bb143648c6be4d151ecd4944af81ada (diff) | |
parent | 28a0c4a9f297064538a018c512cd9bbd00a1a35d (diff) | |
download | ydb-40811e93f3fdf9342a9295369994012420fac548.tar.gz |
Merge branch 'rightlib' into mergelibs-241016-1210
Diffstat (limited to 'contrib/libs/curl/lib/curl_trc.h')
-rw-r--r-- | contrib/libs/curl/lib/curl_trc.h | 140 |
1 files changed, 27 insertions, 113 deletions
diff --git a/contrib/libs/curl/lib/curl_trc.h b/contrib/libs/curl/lib/curl_trc.h index 5f675b453f..ade9108ac7 100644 --- a/contrib/libs/curl/lib/curl_trc.h +++ b/contrib/libs/curl/lib/curl_trc.h @@ -58,7 +58,14 @@ void Curl_debug(struct Curl_easy *data, curl_infotype type, * Output a failure message on registered callbacks for transfer. */ void Curl_failf(struct Curl_easy *data, - const char *fmt, ...) CURL_PRINTF(2, 3); +#if defined(__GNUC__) && !defined(printf) && \ + defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \ + !defined(__MINGW32__) + const char *fmt, ...) + __attribute__((format(printf, 2, 3))); +#else + const char *fmt, ...); +#endif #define failf Curl_failf @@ -77,111 +84,50 @@ void Curl_failf(struct Curl_easy *data, #define CURL_TRC_CF(data, cf, ...) \ do { if(Curl_trc_cf_is_verbose(cf, data)) \ Curl_trc_cf_infof(data, cf, __VA_ARGS__); } while(0) -#define CURL_TRC_WRITE(data, ...) \ - do { if(Curl_trc_ft_is_verbose(data, &Curl_trc_feat_write)) \ - Curl_trc_write(data, __VA_ARGS__); } while(0) -#define CURL_TRC_READ(data, ...) \ - do { if(Curl_trc_ft_is_verbose(data, &Curl_trc_feat_read)) \ - Curl_trc_read(data, __VA_ARGS__); } while(0) - -#ifndef CURL_DISABLE_FTP -#define CURL_TRC_FTP(data, ...) \ - do { if(Curl_trc_ft_is_verbose(data, &Curl_trc_feat_ftp)) \ - Curl_trc_ftp(data, __VA_ARGS__); } while(0) -#endif /* !CURL_DISABLE_FTP */ -#ifndef CURL_DISABLE_SMTP -#define CURL_TRC_SMTP(data, ...) \ - do { if(Curl_trc_ft_is_verbose(data, &Curl_trc_feat_smtp)) \ - Curl_trc_smtp(data, __VA_ARGS__); } while(0) -#endif /* !CURL_DISABLE_SMTP */ -#if defined(USE_WEBSOCKETS) && !defined(CURL_DISABLE_HTTP) -#define CURL_TRC_WS(data, ...) \ - do { if(Curl_trc_ft_is_verbose(data, &Curl_trc_feat_ws)) \ - Curl_trc_ws(data, __VA_ARGS__); } while(0) -#endif /* USE_WEBSOCKETS && !CURL_DISABLE_HTTP */ - -#else /* CURL_HAVE_C99 */ +#else #define infof Curl_infof #define CURL_TRC_CF Curl_trc_cf_infof -#define CURL_TRC_WRITE Curl_trc_write -#define CURL_TRC_READ Curl_trc_read - -#ifndef CURL_DISABLE_FTP -#define CURL_TRC_FTP Curl_trc_ftp -#endif -#ifndef CURL_DISABLE_SMTP -#define CURL_TRC_SMTP Curl_trc_smtp -#endif -#if defined(USE_WEBSOCKETS) && !defined(CURL_DISABLE_HTTP) -#define CURL_TRC_WS Curl_trc_ws #endif -#endif /* !CURL_HAVE_C99 */ - #ifndef CURL_DISABLE_VERBOSE_STRINGS /* informational messages enabled */ -struct curl_trc_feat { - const char *name; - int log_level; -}; -extern struct curl_trc_feat Curl_trc_feat_read; -extern struct curl_trc_feat Curl_trc_feat_write; - -#define Curl_trc_is_verbose(data) \ - ((data) && (data)->set.verbose && \ - (!(data)->state.feat || \ - ((data)->state.feat->log_level >= CURL_LOG_LVL_INFO))) +#define Curl_trc_is_verbose(data) ((data) && (data)->set.verbose) #define Curl_trc_cf_is_verbose(cf, data) \ - (Curl_trc_is_verbose(data) && \ - (cf) && (cf)->cft->log_level >= CURL_LOG_LVL_INFO) -#define Curl_trc_ft_is_verbose(data, ft) \ - (Curl_trc_is_verbose(data) && \ - (ft)->log_level >= CURL_LOG_LVL_INFO) + ((data) && (data)->set.verbose && \ + (cf) && (cf)->cft->log_level >= CURL_LOG_LVL_INFO) /** * Output an informational message when transfer's verbose logging is enabled. */ void Curl_infof(struct Curl_easy *data, - const char *fmt, ...) CURL_PRINTF(2, 3); +#if defined(__GNUC__) && !defined(printf) && defined(CURL_HAVE_C99) && \ + !defined(__MINGW32__) + const char *fmt, ...) + __attribute__((format(printf, 2, 3))); +#else + const char *fmt, ...); +#endif /** * Output an informational message when both transfer's verbose logging * and connection filters verbose logging are enabled. */ void Curl_trc_cf_infof(struct Curl_easy *data, struct Curl_cfilter *cf, - const char *fmt, ...) CURL_PRINTF(3, 4); -void Curl_trc_ft_infof(struct Curl_easy *data, struct curl_trc_feat *ft, - const char *fmt, ...) CURL_PRINTF(3, 4); -void Curl_trc_write(struct Curl_easy *data, - const char *fmt, ...) CURL_PRINTF(2, 3); -void Curl_trc_read(struct Curl_easy *data, - const char *fmt, ...) CURL_PRINTF(2, 3); - -#ifndef CURL_DISABLE_FTP -extern struct curl_trc_feat Curl_trc_feat_ftp; -void Curl_trc_ftp(struct Curl_easy *data, - const char *fmt, ...) CURL_PRINTF(2, 3); -#endif -#ifndef CURL_DISABLE_SMTP -extern struct curl_trc_feat Curl_trc_feat_smtp; -void Curl_trc_smtp(struct Curl_easy *data, - const char *fmt, ...) CURL_PRINTF(2, 3); -#endif -#if defined(USE_WEBSOCKETS) && !defined(CURL_DISABLE_HTTP) -extern struct curl_trc_feat Curl_trc_feat_ws; -void Curl_trc_ws(struct Curl_easy *data, - const char *fmt, ...) CURL_PRINTF(2, 3); +#if defined(__GNUC__) && !defined(printf) && defined(CURL_HAVE_C99) && \ + !defined(__MINGW32__) + const char *fmt, ...) + __attribute__((format(printf, 3, 4))); +#else + const char *fmt, ...); #endif - #else /* defined(CURL_DISABLE_VERBOSE_STRINGS) */ /* All informational messages are not compiled in for size savings */ -#define Curl_trc_is_verbose(d) (FALSE) -#define Curl_trc_cf_is_verbose(x,y) (FALSE) -#define Curl_trc_ft_is_verbose(x,y) (FALSE) +#define Curl_trc_is_verbose(d) ((void)(d), FALSE) +#define Curl_trc_cf_is_verbose(x,y) ((void)(x), (void)(y), FALSE) static void Curl_infof(struct Curl_easy *data, const char *fmt, ...) { @@ -195,38 +141,6 @@ static void Curl_trc_cf_infof(struct Curl_easy *data, (void)data; (void)cf; (void)fmt; } -struct curl_trc_feat; - -static void Curl_trc_ft_infof(struct Curl_easy *data, - struct curl_trc_feat *ft, - const char *fmt, ...) -{ - (void)data; (void)ft; (void)fmt; -} - -static void Curl_trc_write(struct Curl_easy *data, const char *fmt, ...) -{ - (void)data; (void)fmt; -} - -static void Curl_trc_read(struct Curl_easy *data, const char *fmt, ...) -{ - (void)data; (void)fmt; -} - -#ifndef CURL_DISABLE_FTP -static void Curl_trc_ftp(struct Curl_easy *data, const char *fmt, ...) -{ - (void)data; (void)fmt; -} -#endif -#ifndef CURL_DISABLE_SMTP -static void Curl_trc_smtp(struct Curl_easy *data, const char *fmt, ...) -{ - (void)data; (void)fmt; -} -#endif - #endif /* !defined(CURL_DISABLE_VERBOSE_STRINGS) */ #endif /* HEADER_CURL_TRC_H */ |