From a34831a2e98538346be4d9e312f96261e50b5dfb Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Thu, 23 Nov 2023 19:46:25 +0900 Subject: [PATCH] minor fixes --- lib/fcgi-cli.c | 2 +- lib/hio-cmn.h | 12 +++++++++++- lib/http-cgi.c | 2 +- lib/http-fcgi.c | 6 +++--- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/lib/fcgi-cli.c b/lib/fcgi-cli.c index 0fd3f64..2efb1e8 100644 --- a/lib/fcgi-cli.c +++ b/lib/fcgi-cli.c @@ -248,7 +248,7 @@ static int sck_on_read (hio_dev_sck_t* sck, const void* data, hio_iolen_t dlen, if (!sess || !sess->active) { - /* discard the record. no associated sessoin or inactive session */ + /* discard the record. no associated session or inactive session */ goto back_to_header; } diff --git a/lib/hio-cmn.h b/lib/hio-cmn.h index 424c8d4..8f8edcd 100644 --- a/lib/hio-cmn.h +++ b/lib/hio-cmn.h @@ -773,6 +773,14 @@ struct hio_cmgr_t # define HIO_UNUSED #endif +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 202311L) +# define HIO_NORETURN noreturn +#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) +# define HIO_NORETURN _Noreturn +#else +# define HIO_NORETURN +#endif + /** * The HIO_TYPE_IS_SIGNED() macro determines if a type is signed. * \code @@ -1004,7 +1012,9 @@ struct hio_cmgr_t #define HIO_STATIC_JOIN_INNER(x, y) x ## y #define HIO_STATIC_JOIN(x, y) HIO_STATIC_JOIN_INNER(x, y) -#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 202311L) +# define HIO_STATIC_ASSERT(expr) static_assert (expr, "invalid assertion") +#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) # define HIO_STATIC_ASSERT(expr) _Static_assert (expr, "invalid assertion") #elif defined(__cplusplus) && (__cplusplus >= 201103L) # define HIO_STATIC_ASSERT(expr) static_assert (expr, "invalid assertion") diff --git a/lib/http-cgi.c b/lib/http-cgi.c index f90796b..46528a7 100644 --- a/lib/http-cgi.c +++ b/lib/http-cgi.c @@ -1031,7 +1031,7 @@ int hio_svc_htts_docgi (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* r if ((n = bind_task_to_peer(cgi, csck, req, docroot, script)) <= -1) { - if (n == -2) status_code == HIO_HTTP_STATUS_FORBIDDEN; + if (n == -2) status_code = HIO_HTTP_STATUS_FORBIDDEN; goto oops; } bound_to_peer = 1; diff --git a/lib/http-fcgi.c b/lib/http-fcgi.c index 7c40786..b15ae2f 100644 --- a/lib/http-fcgi.c +++ b/lib/http-fcgi.c @@ -388,7 +388,7 @@ static void fcgi_client_on_disconnect (hio_dev_sck_t* sck) static int fcgi_client_on_read (hio_dev_sck_t* sck, const void* buf, hio_iolen_t len, const hio_skad_t* srcaddr) { - hio_t* hio = sck->hio; + hio_t* hio HIO_UNUSED = sck->hio; hio_svc_htts_cli_t* cli = hio_dev_sck_getxtn(sck); fcgi_t* fcgi = (fcgi_t*)cli->task; int n; @@ -429,7 +429,7 @@ oops: static int fcgi_client_on_write (hio_dev_sck_t* sck, hio_iolen_t wrlen, void* wrctx, const hio_skad_t* dstaddr) { - hio_t* hio = sck->hio; + hio_t* hio HIO_UNUSED = sck->hio; hio_svc_htts_cli_t* cli = hio_dev_sck_getxtn(sck); fcgi_t* fcgi = (fcgi_t*)cli->task; int n; @@ -464,7 +464,7 @@ static int peer_capture_request_header (hio_htre_t* req, const hio_bch_t* key, c { fcgi_t* fcgi = (fcgi_t*)ctx; hio_svc_htts_t* htts = fcgi->htts; - hio_t* hio = htts->hio; + hio_t* hio HIO_UNUSED = htts->hio; if (hio_comp_bcstr(key, "Connection", 1) != 0 && hio_comp_bcstr(key, "Transfer-Encoding", 1) != 0 &&