Skip to content

Commit 496ecbd

Browse files
committed
ssl_poll_perf: address compiler warnings
The changes address the following compiler warnings (reported by GCC 14): ssl_poll_perf.c: In function ‘srvapp_setup_response’: ssl_poll_perf.c:1553:33: warning: variable ‘pesb’ set but not used [-Wunused-but-set-variable] 1553 | struct poll_event_sbstream *pesb; | ^~~~ ssl_poll_perf.c: In function ‘clntapp_write_custreamcb’: ssl_poll_perf.c:2389:28: warning: unused variable ‘rb’ [-Wunused-variable] 2389 | struct request_buffer *rb; | ^~ ssl_poll_perf.c: In function ‘clntapp_update_pec’: ssl_poll_perf.c:2469:9: warning: variable ‘e’ set but not used [-Wunused-but-set-variable] 2469 | int e; | ^ ssl_poll_perf.c: In function ‘main’: ssl_poll_perf.c:3138:9: warning: unused variable ‘ccount’ [-Wunused-variable] 3138 | int ccount = 0; | ^~~~~~ ssl_poll_perf.c: At top level: ssl_poll_perf.c:1007:1: warning: ‘stream_state_str’ defined but not used [-Wunused-function] 1007 | stream_state_str(int stream_state) | ^~~~~~~~~~~~~~~~ ssl_poll_perf.c:954:1: warning: ‘err_str_n’ defined but not used [-Wunused-function] 954 | err_str_n(unsigned long e, char *buf, size_t buf_sz) | ^~~~~~~~~ Complements: openssl#64 Signed-off-by: Eugene Syromiatnikov <[email protected]>
1 parent 2821964 commit 496ecbd

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

source/ssl_poll_perf.c

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#endif
4444

4545
#include <openssl/bio.h>
46+
#include <openssl/e_os2.h>
4647
#include <openssl/ssl.h>
4748
#include <openssl/err.h>
4849
#include <openssl/quic.h>
@@ -72,15 +73,21 @@
7273
* then the server sends 64kB of data in HTTP/1.0 response.
7374
*/
7475

76+
static ossl_inline void
77+
debug_printf(FILE * const f, const char * const fmt, ...)
78+
{
7579
#ifdef DEBUG
76-
# define DPRINTF fprintf
77-
# define DPRINTFC fprintf
78-
# define DPRINTFS fprintf
79-
#else
80-
# define DPRINTF(...) (void)(0)
81-
# define DPRINTFC(...) (void)(0)
82-
# define DPRINTFS(...) (void)(0)
80+
va_list ap;
81+
82+
va_start(ap, fmt);
83+
vfprintf(f, fmt, ap);
84+
va_end(ap);
8385
#endif
86+
}
87+
88+
#define DPRINTF debug_printf
89+
#define DPRINTFC debug_printf
90+
#define DPRINTFS debug_printf
8491

8592
/*
8693
* format string so we can print SSL_poll() events in more informative
@@ -962,9 +969,7 @@ handle_ssl_error(struct poll_event *pe, int rc, const char *caller)
962969
{
963970
SSL *ssl = get_ssl_from_pe(pe);
964971
int ssl_error, rv;
965-
#ifdef DEBUG
966972
char err_str[120];
967-
#endif
968973

969974
/* may be we should use SSL_shutdown_ex() to signal peer what's going on */
970975
ssl_error = SSL_get_error(ssl, rc);
@@ -2386,7 +2391,6 @@ clntapp_write_cstreamcb(struct poll_event *pe)
23862391
static int
23872392
clntapp_write_custreamcb(struct poll_event *pe)
23882393
{
2389-
struct request_buffer *rb;
23902394
struct poll_event_custream *pecsu = pecsu = pe_to_custream(pe);
23912395

23922396
if (pecsu == NULL) {
@@ -3135,7 +3139,6 @@ main(int argc, char *argv[])
31353139
server_thread,
31363140
0
31373141
};
3138-
int ccount = 0;
31393142
const char *ccountstr = "10";
31403143
const char *bstreamstr = "10";
31413144
const char *ustreamstr = "10";

0 commit comments

Comments
 (0)