commit 29a39f4fac4621f7de8c135f5eb94f269a07843b
parent 28555183e68eb95ba583458c53f8ce452f8fd00c
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date: Fri, 30 Oct 2026 17:33:49 +0100
Used MHD_FN_PAR_NONNULL_IF_NONZERO_ in internal functions
Diffstat:
20 files changed, 44 insertions(+), 12 deletions(-)
diff --git a/src/mhd2/daemon_add_conn.c b/src/mhd2/daemon_add_conn.c
@@ -197,7 +197,8 @@ notify_app_conn (struct MHD_Daemon *restrict daemon,
* error on failure (the @a client_socket is closed)
*/
static MHD_FN_MUST_CHECK_RESULT_
-MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_INOUT_SIZE_ (4, 3)
+MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_NONNULL_IF_NONZERO_ (4, 3)
+MHD_FN_PAR_INOUT_SIZE_ (4, 3)
MHD_FN_PAR_NONNULL_ (9) MHD_FN_PAR_OUT_ (9) enum MHD_StatusCode
new_connection_prepare_ (struct MHD_Daemon *restrict daemon,
MHD_Socket client_socket,
@@ -583,7 +584,8 @@ new_connection_process_ (struct MHD_Daemon *restrict daemon,
* @return #MHD_SC_OK on success,
* error on failure (the @a client_socket is closed)
*/
-static MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_INOUT_SIZE_ (4, 3) enum MHD_StatusCode
+static MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_NONNULL_IF_NONZERO_ (4, 3)
+MHD_FN_PAR_INOUT_SIZE_ (4, 3) enum MHD_StatusCode
internal_add_connection (struct MHD_Daemon *daemon,
MHD_Socket client_socket,
size_t addrlen,
diff --git a/src/mhd2/mempool_funcs.c b/src/mhd2/mempool_funcs.c
@@ -464,7 +464,7 @@ mhd_pool_allocate (struct mhd_MemoryPool *restrict pool,
}
-MHD_INTERNAL bool
+MHD_INTERNAL MHD_FN_PAR_NONNULL_IF_NONZERO_ (2, 3) bool
mhd_pool_is_resizable_inplace (struct mhd_MemoryPool *restrict pool,
void *restrict block,
size_t block_size)
@@ -524,6 +524,7 @@ mhd_pool_try_alloc (struct mhd_MemoryPool *restrict pool,
MHD_INTERNAL
+MHD_FN_PAR_NONNULL_IF_NONZERO_ (2, 3)
mhd_FN_RET_SIZED (4)
void *
mhd_pool_reallocate (struct mhd_MemoryPool *restrict pool,
@@ -608,7 +609,7 @@ mhd_pool_reallocate (struct mhd_MemoryPool *restrict pool,
}
-MHD_INTERNAL void
+MHD_INTERNAL MHD_FN_PAR_NONNULL_IF_NONZERO_ (2, 3) void
mhd_pool_deallocate (struct mhd_MemoryPool *restrict pool,
void *restrict block,
size_t block_size)
@@ -701,6 +702,7 @@ mhd_pool_deallocate (struct mhd_MemoryPool *restrict pool,
MHD_INTERNAL
+MHD_FN_PAR_NONNULL_IF_NONZERO_ (2, 3)
mhd_FN_RET_SIZED (4) mhd_FN_RET_ALIGNED (mhd_MEMPOOL_ALIGN_SIZE)
void *
mhd_pool_reset (struct mhd_MemoryPool *restrict pool,
diff --git a/src/mhd2/mempool_funcs.h b/src/mhd2/mempool_funcs.h
@@ -130,7 +130,8 @@ mhd_FN_RET_ALIGNED (mhd_MEMPOOL_ALIGN_SIZE);
MHD_INTERNAL bool
mhd_pool_is_resizable_inplace (struct mhd_MemoryPool *restrict pool,
void *restrict block,
- size_t block_size);
+ size_t block_size)
+MHD_FN_PAR_NONNULL_IF_NONZERO_ (2, 3);
/**
* Try to allocate @a size bytes memory area from the @a pool.
@@ -181,6 +182,7 @@ mhd_pool_reallocate (struct mhd_MemoryPool *restrict pool,
void *restrict old,
size_t old_size,
size_t new_size)
+MHD_FN_PAR_NONNULL_IF_NONZERO_ (2, 3)
mhd_FN_RET_SIZED (4);
/**
@@ -217,7 +219,8 @@ mhd_pool_get_free (struct mhd_MemoryPool *restrict pool);
MHD_INTERNAL void
mhd_pool_deallocate (struct mhd_MemoryPool *restrict pool,
void *restrict block,
- size_t block_size);
+ size_t block_size)
+MHD_FN_PAR_NONNULL_IF_NONZERO_ (2, 3);
/**
@@ -238,6 +241,7 @@ mhd_pool_reset (struct mhd_MemoryPool *restrict pool,
void *restrict keep,
size_t copy_bytes,
size_t new_size)
+MHD_FN_PAR_NONNULL_IF_NONZERO_ (2, 3)
mhd_FN_RET_SIZED (4) mhd_FN_RET_ALIGNED (mhd_MEMPOOL_ALIGN_SIZE);
#endif /* ! MHD_MEMPOOL_FUNCS_H */
diff --git a/src/mhd2/mhd_send.c b/src/mhd2/mhd_send.c
@@ -960,6 +960,7 @@ mhd_send_data (struct MHD_Connection *restrict connection,
MHD_INTERNAL
MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_NONNULL_ (3)
+MHD_FN_PAR_NONNULL_IF_NONZERO_ (6, 5)
MHD_FN_PAR_IN_SIZE_ (3, 2) MHD_FN_PAR_IN_SIZE_ (6, 5) enum mhd_SocketError
mhd_send_hdr_and_body (struct MHD_Connection *restrict connection,
size_t header_size,
diff --git a/src/mhd2/mhd_send.h b/src/mhd2/mhd_send.h
@@ -118,6 +118,7 @@ mhd_send_hdr_and_body (struct MHD_Connection *restrict connection,
bool complete_response,
size_t *restrict sent)
MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_NONNULL_ (3)
+MHD_FN_PAR_NONNULL_IF_NONZERO_ (6, 5)
MHD_FN_PAR_IN_SIZE_ (3, 2) MHD_FN_PAR_IN_SIZE_ (6, 5) MHD_FN_PAR_OUT_ (8);
#if defined(mhd_USE_SENDFILE)
diff --git a/src/mhd2/mhd_tls_internal.c b/src/mhd2/mhd_tls_internal.c
@@ -58,6 +58,7 @@
#include "mhd_tls_internal.h"
MHD_INTERNAL
+MHD_FN_PAR_NONNULL_IF_NONZERO_ (2, 1)
MHD_FN_PAR_IN_SIZE_ (2, 1) enum mhd_TlsAlpnProt
mhd_tls_alpn_decode_n (size_t alpn_id_size,
const unsigned char *alpn_id)
diff --git a/src/mhd2/mhd_tls_internal.h b/src/mhd2/mhd_tls_internal.h
@@ -125,6 +125,7 @@
MHD_INTERNAL enum mhd_TlsAlpnProt
mhd_tls_alpn_decode_n (size_t alpn_id_size,
const unsigned char *alpn_id)
+MHD_FN_PAR_NONNULL_IF_NONZERO_ (2, 1)
MHD_FN_PAR_IN_SIZE_ (2, 1);
diff --git a/src/mhd2/respond_with_error.c b/src/mhd2/respond_with_error.c
@@ -67,6 +67,8 @@
MHD_INTERNAL
MHD_FN_PAR_NONNULL_ (1)
+MHD_FN_PAR_NONNULL_IF_NONZERO_ (4, 3)
+MHD_FN_PAR_NONNULL_IF_NONZERO_ (6, 5)
MHD_FN_PAR_CSTR_ (4) MHD_FN_PAR_CSTR_ (6) void
respond_with_error_len (struct MHD_Connection *c,
unsigned int http_code,
diff --git a/src/mhd2/respond_with_error.h b/src/mhd2/respond_with_error.h
@@ -73,6 +73,8 @@ respond_with_error_len (struct MHD_Connection *c,
size_t add_hdr_line_len,
char *add_hdr_line)
MHD_FN_PAR_NONNULL_ (1)
+MHD_FN_PAR_NONNULL_IF_NONZERO_ (4, 3)
+MHD_FN_PAR_NONNULL_IF_NONZERO_ (6, 5)
MHD_FN_PAR_CSTR_ (4) MHD_FN_PAR_CSTR_ (6);
#ifdef MHD_ENABLE_AUTO_MESSAGES_BODIES
diff --git a/src/mhd2/response_from.c b/src/mhd2/response_from.c
@@ -244,7 +244,8 @@ MHD_response_from_buffer_copy (
}
-static MHD_FN_PAR_IN_SIZE_ (3, 2) struct MHD_Response *
+static MHD_FN_PAR_NONNULL_IF_NONZERO_ (3, 2)
+MHD_FN_PAR_IN_SIZE_ (3, 2) struct MHD_Response *
response_from_iovec_inner (
enum MHD_HTTP_StatusCode sc,
unsigned int iov_count,
@@ -457,6 +458,8 @@ MHD_response_from_pipe (enum MHD_HTTP_StatusCode sc,
*
*/
MHD_INTERNAL
+MHD_FN_PAR_NONNULL_IF_NONZERO_ (3, 2)
+MHD_FN_PAR_NONNULL_IF_NONZERO_ (5, 4)
MHD_FN_PAR_CSTR_ (3) MHD_FN_PAR_CSTR_ (5) struct MHD_Response *
mhd_response_special_for_error (unsigned int sc,
size_t cntn_len,
diff --git a/src/mhd2/response_from.h b/src/mhd2/response_from.h
@@ -75,6 +75,8 @@ mhd_response_special_for_error (unsigned int sc,
const char *cntn,
size_t spec_hdr_len,
char *spec_hdr)
+MHD_FN_PAR_NONNULL_IF_NONZERO_ (3, 2)
+MHD_FN_PAR_NONNULL_IF_NONZERO_ (5, 4)
MHD_FN_PAR_CSTR_ (3) MHD_FN_PAR_CSTR_ (5);
diff --git a/src/mhd2/stream_funcs.c b/src/mhd2/stream_funcs.c
@@ -353,7 +353,8 @@ mhd_stream_release_write_buffer (struct MHD_Connection *restrict c)
MHD_INTERNAL
-MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_IN_SIZE_ (4, 3) unsigned int
+MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_NONNULL_IF_NONZERO_ (4, 3)
+MHD_FN_PAR_IN_SIZE_ (4, 3) unsigned int
mhd_stream_get_no_space_err_status_code (struct MHD_Connection *restrict c,
enum MHD_ProcRecvDataStage stage,
size_t add_element_size,
diff --git a/src/mhd2/stream_funcs.h b/src/mhd2/stream_funcs.h
@@ -140,7 +140,8 @@ mhd_stream_get_no_space_err_status_code (struct MHD_Connection *restrict c,
enum MHD_ProcRecvDataStage stage,
size_t add_element_size,
const char *restrict add_element)
-MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_IN_SIZE_ (4, 3);
+MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_NONNULL_IF_NONZERO_ (4, 3)
+MHD_FN_PAR_IN_SIZE_ (4, 3);
/**
* Switch connection from recv mode to send mode.
diff --git a/src/mhd2/stream_process_request.c b/src/mhd2/stream_process_request.c
@@ -1628,7 +1628,7 @@ mhd_stream_switch_to_rq_headers_proc (struct MHD_Connection *restrict c)
* @param add_header_size the size of the @a add_header
*/
mhd_static_inline
-MHD_FN_PAR_NONNULL_ (1) void
+MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_NONNULL_IF_NONZERO_ (2, 3) void
handle_req_headers_no_space (struct MHD_Connection *restrict c,
const char *restrict add_header,
size_t add_header_size)
@@ -1656,7 +1656,7 @@ handle_req_headers_no_space (struct MHD_Connection *restrict c,
* @param add_footer_size the size of the @a add_footer
*/
mhd_static_inline
-MHD_FN_PAR_NONNULL_ (1) void
+MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_NONNULL_IF_NONZERO_ (2, 3) void
handle_req_footers_no_space (struct MHD_Connection *restrict c,
const char *restrict add_footer,
size_t add_footer_size)
@@ -3831,7 +3831,7 @@ mhd_stream_process_req_recv_finished (struct MHD_Connection *restrict c)
* Can be NULL.
* @param chunk_size_line_size the size of the @a chunk_size_line
*/
-static void
+static MHD_FN_PAR_NONNULL_IF_NONZERO_ (2, 3) void
handle_req_chunk_size_line_no_space (struct MHD_Connection *c,
const char *chunk_size_line,
size_t chunk_size_line_size)
diff --git a/src/mhd2/tls_multi_funcs.c b/src/mhd2/tls_multi_funcs.c
@@ -551,6 +551,7 @@ mhd_tls_multi_thread_cleanup (struct mhd_TlsMultiDaemonData *restrict d_tls)
MHD_INTERNAL MHD_FN_MUST_CHECK_RESULT_
MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_NONNULL_ (2)
MHD_FN_PAR_NONNULL_ (4) MHD_FN_PAR_NONNULL_ (6)
+MHD_FN_PAR_NONNULL_IF_NONZERO_ (8, 7)
MHD_FN_PAR_OUT_ (2)
MHD_FN_PAR_IN_SIZE_ (4, 3) MHD_FN_PAR_IN_SIZE_ (6, 5)
MHD_FN_PAR_IN_SIZE_ (8, 7)
diff --git a/src/mhd2/tls_multi_funcs.h b/src/mhd2/tls_multi_funcs.h
@@ -210,6 +210,7 @@ mhd_tls_multi_cred_create (struct mhd_TlsMultiDaemonData *restrict d_tls,
MHD_FN_MUST_CHECK_RESULT_
MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_NONNULL_ (2)
MHD_FN_PAR_NONNULL_ (4) MHD_FN_PAR_NONNULL_ (6)
+MHD_FN_PAR_NONNULL_IF_NONZERO_ (8, 7)
MHD_FN_PAR_OUT_ (2)
MHD_FN_PAR_IN_SIZE_ (4, 3) MHD_FN_PAR_IN_SIZE_ (6, 5)
MHD_FN_PAR_IN_SIZE_ (8, 7)
diff --git a/src/mhd2/tls_open_funcs.c b/src/mhd2/tls_open_funcs.c
@@ -2061,6 +2061,7 @@ mem_passwd_cb (char *buf,
*/
static MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_NONNULL_ (2)
MHD_FN_PAR_NONNULL_ (4) MHD_FN_MUST_CHECK_RESULT_
+MHD_FN_PAR_NONNULL_IF_NONZERO_ (6, 5)
MHD_FN_PAR_IN_SIZE_ (4, 3) MHD_FN_PAR_IN_SIZE_ (6, 5) MHD_FN_PAR_CSTR_ (6)
enum mhd_TlsCredCreateResult
cred_read_key (struct mhd_TlsOpenDaemonData *restrict d_tls,
@@ -2133,6 +2134,7 @@ cred_read_key (struct mhd_TlsOpenDaemonData *restrict d_tls,
MHD_INTERNAL MHD_FN_MUST_CHECK_RESULT_
MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_NONNULL_ (2)
MHD_FN_PAR_NONNULL_ (4) MHD_FN_PAR_NONNULL_ (6)
+MHD_FN_PAR_NONNULL_IF_NONZERO_ (8, 7)
MHD_FN_PAR_OUT_ (2)
MHD_FN_PAR_IN_SIZE_ (4, 3) MHD_FN_PAR_IN_SIZE_ (6, 5)
MHD_FN_PAR_IN_SIZE_ (8, 7)
diff --git a/src/mhd2/tls_open_funcs.h b/src/mhd2/tls_open_funcs.h
@@ -212,6 +212,7 @@ mhd_tls_open_cred_create (struct mhd_TlsOpenDaemonData *restrict d_tls,
MHD_FN_MUST_CHECK_RESULT_
MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_NONNULL_ (2)
MHD_FN_PAR_NONNULL_ (4) MHD_FN_PAR_NONNULL_ (6)
+MHD_FN_PAR_NONNULL_IF_NONZERO_ (8, 7)
MHD_FN_PAR_OUT_ (2)
MHD_FN_PAR_IN_SIZE_ (4, 3) MHD_FN_PAR_IN_SIZE_ (6, 5)
MHD_FN_PAR_IN_SIZE_ (8, 7)
diff --git a/src/mhd2/upgrade_prep.c b/src/mhd2/upgrade_prep.c
@@ -147,6 +147,7 @@ enum mhd_UpgradeHeaderBuildRes
*/
static MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_NONNULL_ (3)
MHD_FN_PAR_OUT_SIZE_ (3, 2) MHD_FN_PAR_OUT_ (4) MHD_FN_PAR_CSTR_ (5)
+MHD_FN_PAR_NONNULL_IF_NONZERO_ (7, 6)
MHD_FN_PAR_IN_SIZE_ (7, 6) enum mhd_UpgradeHeaderBuildRes
build_reply_header (struct MHD_Connection *restrict c,
const size_t buf_size,
@@ -389,6 +390,7 @@ build_reply_header (struct MHD_Connection *restrict c,
*/
static MHD_FN_PAR_NONNULL_ (1)
MHD_FN_PAR_NONNULL_ (2) MHD_FN_PAR_CSTR_ (2)
+MHD_FN_PAR_NONNULL_IF_NONZERO_ (4, 3)
MHD_FN_PAR_IN_SIZE_ (4, 3) bool
connection_prepare_for_upgrade (
struct MHD_Connection *restrict c,
@@ -431,6 +433,7 @@ connection_prepare_for_upgrade (
MHD_INTERNAL
MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_NONNULL_ (2) MHD_FN_PAR_CSTR_ (2)
+MHD_FN_PAR_NONNULL_IF_NONZERO_ (4, 3)
MHD_FN_PAR_IN_SIZE_ (4, 3) bool
mhd_upgrade_prep_for_action (struct MHD_Request *restrict req,
const char *restrict upgrade_hdr_value,
diff --git a/src/mhd2/upgrade_prep.h b/src/mhd2/upgrade_prep.h
@@ -81,6 +81,7 @@ mhd_upgrade_prep_for_action (struct MHD_Request *restrict req,
const struct MHD_NameValueCStr *restrict headers,
bool is_upload_act)
MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_NONNULL_ (2) MHD_FN_PAR_CSTR_ (2)
+MHD_FN_PAR_NONNULL_IF_NONZERO_ (4, 3)
MHD_FN_PAR_IN_SIZE_ (4, 3);
#endif /* ! MHD_UPGRADE_PREP_H */