[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd2] 02/12: Unified debug macro checks
From: |
Admin |
Subject: |
[libmicrohttpd2] 02/12: Unified debug macro checks |
Date: |
Fri, 06 Jun 2025 16:01:10 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd2.
commit 6429e7a384b340e634656536bd2bfe0259118e3c
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
AuthorDate: Tue Jun 3 14:13:55 2025 +0200
Unified debug macro checks
---
src/incl_priv/mhd_sys_options.h | 2 +-
src/mhd2/auth_digest.c | 44 ++++++++++++++++++++---------------------
src/mhd2/daemon_add_conn.c | 4 ++--
src/mhd2/mhd_mempool.c | 4 ++--
src/mhd2/mhd_reply.h | 2 +-
src/mhd2/stream_process_reply.c | 2 +-
src/tools/perf_replies.c | 2 +-
7 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/src/incl_priv/mhd_sys_options.h b/src/incl_priv/mhd_sys_options.h
index c79c312..3dbc3fd 100644
--- a/src/incl_priv/mhd_sys_options.h
+++ b/src/incl_priv/mhd_sys_options.h
@@ -507,7 +507,7 @@
# define mhd_SEND_SPIPE_SUPPRESS_NEEDED 1
#endif
-#ifdef _DEBUG
+#ifndef NDEBUG
# ifndef MHD_NO_TLS_DEBUG_MESSAGES
# ifndef mhd_USE_TLS_DEBUG_MESSAGES
/**
diff --git a/src/mhd2/auth_digest.c b/src/mhd2/auth_digest.c
index 3c51309..b40f482 100644
--- a/src/mhd2/auth_digest.c
+++ b/src/mhd2/auth_digest.c
@@ -1430,12 +1430,12 @@ struct DigestAlgorithm
/**
* Buffer for hex-print of the final digest.
*/
-#ifdef _DEBUG
+#ifndef NDEBUG
bool uninitialised; /**< The structure has been not set-up */
bool algo_selected; /**< The algorithm has been selected */
bool ready_for_hashing; /**< The structure is ready to hash data */
bool hashing; /**< Some data has been hashed, but the digest has not
finalised yet */
-#endif /* _DEBUG */
+#endif /* NDEBUG */
};
@@ -1486,7 +1486,7 @@ digest_get_size (struct DigestAlgorithm *da)
MHD_static_inline_ void
digest_setup_zero (struct DigestAlgorithm *da)
{
-#ifdef _DEBUG
+#ifndef NDEBUG
da->uninitialised = false;
da->algo_selected = false;
da->ready_for_hashing = false;
@@ -1552,7 +1552,7 @@ MHD_static_inline_ MHD_FN_MUST_CHECK_RESULT_
MHD_FN_PAR_NONNULL_ALL_ bool
digest_init_one_time (struct DigestAlgorithm *da,
enum MHD_DigestBaseAlgo algo)
{
-#ifdef _DEBUG
+#ifndef NDEBUG
da->uninitialised = false;
da->algo_selected = false;
da->ready_for_hashing = false;
@@ -1563,11 +1563,11 @@ digest_init_one_time (struct DigestAlgorithm *da,
case MHD_DIGEST_BASE_ALGO_MD5:
#ifdef MHD_SUPPORT_MD5
da->algo = MHD_DIGEST_BASE_ALGO_MD5;
-# ifdef _DEBUG
+# ifndef NDEBUG
da->algo_selected = true;
# endif
mhd_MD5_init_one_time (&(da->ctx.md5_ctx));
-# ifdef _DEBUG
+# ifndef NDEBUG
da->ready_for_hashing = true;
# endif
return true;
@@ -1577,11 +1577,11 @@ digest_init_one_time (struct DigestAlgorithm *da,
case MHD_DIGEST_BASE_ALGO_SHA256:
#ifdef MHD_SUPPORT_SHA256
da->algo = MHD_DIGEST_BASE_ALGO_SHA256;
-# ifdef _DEBUG
+# ifndef NDEBUG
da->algo_selected = true;
# endif
mhd_SHA256_init_one_time (&(da->ctx.sha256_ctx));
-# ifdef _DEBUG
+# ifndef NDEBUG
da->ready_for_hashing = true;
# endif
return true;
@@ -1591,11 +1591,11 @@ digest_init_one_time (struct DigestAlgorithm *da,
case MHD_DIGEST_BASE_ALGO_SHA512_256:
#ifdef MHD_SUPPORT_SHA512_256
da->algo = MHD_DIGEST_BASE_ALGO_SHA512_256;
-# ifdef _DEBUG
+# ifndef NDEBUG
da->algo_selected = true;
# endif
mhd_SHA512_256_init_one_time (&(da->ctx.sha512_256_ctx));
-# ifdef _DEBUG
+# ifndef NDEBUG
da->ready_for_hashing = true;
# endif
return true;
@@ -1661,7 +1661,7 @@ digest_update (struct DigestAlgorithm *restrict da,
mhd_UNREACHABLE ();
break;
}
-#ifdef _DEBUG
+#ifndef NDEBUG
da->hashing = true;
#endif
}
@@ -1749,12 +1749,12 @@ digest_calc_hash (struct DigestAlgorithm *da,
#ifdef MHD_SUPPORT_MD5
# ifdef mhd_MD5_HAS_FINISH
mhd_MD5_finish (&da->ctx.md5_ctx, digest);
-# ifdef _DEBUG
+# ifndef NDEBUG
da->ready_for_hashing = false;
# endif /* _DEBUG */
# else /* ! mhd_MD5_HAS_FINISH */
mhd_MD5_finish_reset (&da->ctx.md5_ctx, digest);
-# ifdef _DEBUG
+# ifndef NDEBUG
da->ready_for_hashing = true;
# endif /* _DEBUG */
# endif /* ! mhd_MD5_HAS_FINISH */
@@ -1767,12 +1767,12 @@ digest_calc_hash (struct DigestAlgorithm *da,
#ifdef MHD_SUPPORT_SHA256
# ifdef mhd_SHA256_HAS_FINISH
mhd_SHA256_finish (&da->ctx.sha256_ctx, digest);
-# ifdef _DEBUG
+# ifndef NDEBUG
da->ready_for_hashing = false;
# endif /* _DEBUG */
# else /* ! mhd_SHA256_HAS_FINISH */
mhd_SHA256_finish_reset (&da->ctx.sha256_ctx, digest);
-# ifdef _DEBUG
+# ifndef NDEBUG
da->ready_for_hashing = true;
# endif /* _DEBUG */
# endif /* ! mhd_SHA256_HAS_FINISH */
@@ -1785,12 +1785,12 @@ digest_calc_hash (struct DigestAlgorithm *da,
#ifdef MHD_SUPPORT_SHA512_256
#ifdef mhd_SHA512_256_HAS_FINISH
mhd_SHA512_256_finish (&da->ctx.sha512_256_ctx, digest);
-#ifdef _DEBUG
+#ifndef NDEBUG
da->ready_for_hashing = false;
#endif /* _DEBUG */
#else /* ! mhd_SHA512_256_HAS_FINISH */
mhd_SHA512_256_finish_reset (&da->ctx.sha512_256_ctx, digest);
-#ifdef _DEBUG
+#ifndef NDEBUG
da->ready_for_hashing = true;
#endif /* _DEBUG */
#endif /* ! mhd_SHA512_256_HAS_FINISH */
@@ -1804,7 +1804,7 @@ digest_calc_hash (struct DigestAlgorithm *da,
mhd_UNREACHABLE ();
break;
}
-#ifdef _DEBUG
+#ifndef NDEBUG
da->hashing = false;
#endif /* _DEBUG */
}
@@ -1831,7 +1831,7 @@ digest_reset (struct DigestAlgorithm *da)
mhd_assert (da->ready_for_hashing);
# endif /* ! mhd_MD5_HAS_FINISH */
mhd_MD5_reset (&(da->ctx.md5_ctx));
-# ifdef _DEBUG
+# ifndef NDEBUG
da->ready_for_hashing = true;
# endif /* _DEBUG */
#else /* ! MHD_SUPPORT_MD5 */
@@ -1847,7 +1847,7 @@ digest_reset (struct DigestAlgorithm *da)
mhd_assert (da->ready_for_hashing);
#endif /* ! mhd_SHA256_HAS_FINISH */
mhd_SHA256_reset (&(da->ctx.sha256_ctx));
-#ifdef _DEBUG
+#ifndef NDEBUG
da->ready_for_hashing = true;
#endif /* _DEBUG */
#else /* ! MHD_SUPPORT_SHA256 */
@@ -1863,7 +1863,7 @@ digest_reset (struct DigestAlgorithm *da)
mhd_assert (da->ready_for_hashing);
# endif /* ! mhd_SHA512_256_HAS_FINISH */
mhd_SHA512_256_reset (&(da->ctx.sha512_256_ctx));
-# ifdef _DEBUG
+# ifndef NDEBUG
da->ready_for_hashing = true;
# endif /* _DEBUG */
#else /* ! MHD_SUPPORT_SHA512_256 */
@@ -1873,7 +1873,7 @@ digest_reset (struct DigestAlgorithm *da)
case MHD_DIGEST_BASE_ALGO_INVALID:
default:
-#ifdef _DEBUG
+#ifndef NDEBUG
da->ready_for_hashing = false;
#endif
mhd_UNREACHABLE ();
diff --git a/src/mhd2/daemon_add_conn.c b/src/mhd2/daemon_add_conn.c
index 76b8529..b8ae1dd 100644
--- a/src/mhd2/daemon_add_conn.c
+++ b/src/mhd2/daemon_add_conn.c
@@ -860,7 +860,7 @@ mhd_daemon_accept_connection (struct MHD_Daemon *restrict
daemon)
bool sk_spipe_supprs;
bool sk_cloexec;
enum mhd_Tristate sk_non_ip;
-#if defined(_DEBUG) && defined (mhd_USE_ACCEPT4)
+#if !defined(NDEBUG) && defined (mhd_USE_ACCEPT4)
const bool use_accept4 = ! daemon->dbg.avoid_accept4;
#elif defined (mhd_USE_ACCEPT4)
static const bool use_accept4 = true;
@@ -911,7 +911,7 @@ mhd_daemon_accept_connection (struct MHD_Daemon *restrict
daemon)
}
}
#endif /* mhd_USE_ACCEPT4 */
-#if ! defined(mhd_USE_ACCEPT4) || defined(_DEBUG)
+#if ! defined(mhd_USE_ACCEPT4) || !defined(NDEBUG)
if (! use_accept4)
{
s = accept (fd,
diff --git a/src/mhd2/mhd_mempool.c b/src/mhd2/mhd_mempool.c
index d208067..d266f68 100644
--- a/src/mhd2/mhd_mempool.c
+++ b/src/mhd2/mhd_mempool.c
@@ -147,7 +147,7 @@
((uintptr_t) ((const uint8_t*) (p2)))))
#elif defined(FUNC_ATTR_PTRCOMPARE_WORKS) && \
defined(FUNC_ATTR_PTRSUBTRACT_WORKS)
-# ifdef _DEBUG
+# ifndef NDEBUG
/**
* Boolean 'true' if the first pointer is less or equal the second pointer
*/
@@ -173,7 +173,7 @@ mp_ptr_diff_ (const void *p1, const void *p2)
# elif defined(FUNC_ATTR_NOSANITIZE_WORKS)
-# ifdef _DEBUG
+# ifndef NDEBUG
/**
* Boolean 'true' if the first pointer is less or equal the second pointer
*/
diff --git a/src/mhd2/mhd_reply.h b/src/mhd2/mhd_reply.h
index f255b41..49ced3c 100644
--- a/src/mhd2/mhd_reply.h
+++ b/src/mhd2/mhd_reply.h
@@ -49,7 +49,7 @@ struct MHD_Response; /* forward declaration */
*/
struct MHD_Reply_Properties
{
-#ifdef _DEBUG
+#ifndef NDEBUG
bool set; /**< Indicates that other members are set and valid */
#endif /* _DEBUG */
bool use_reply_body_headers; /**< Use reply body-specific headers */
diff --git a/src/mhd2/stream_process_reply.c b/src/mhd2/stream_process_reply.c
index c257069..68a7a64 100644
--- a/src/mhd2/stream_process_reply.c
+++ b/src/mhd2/stream_process_reply.c
@@ -335,7 +335,7 @@ setup_reply_properties (struct MHD_Connection *restrict c)
}
}
-#ifdef _DEBUG
+#ifndef NDEBUG
c->rp.props.set = true;
#endif /* _DEBUG */
}
diff --git a/src/tools/perf_replies.c b/src/tools/perf_replies.c
index 31f1ef7..2bcbb2a 100644
--- a/src/tools/perf_replies.c
+++ b/src/tools/perf_replies.c
@@ -1596,7 +1596,7 @@ static void
print_perf_warnings (void)
{
int newline_needed = 0;
-#if defined (_DEBUG)
+#if !defined(NDEBUG) || defined(_DEBUG)
fprintf (stderr, "WARNING: Running with debug asserts enabled, "
"the performance is suboptimal.\n");
newline_needed |= ! 0;
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd2] branch master updated (2e6777f -> cdd4c1f), Admin, 2025/06/06
- [libmicrohttpd2] 03/12: mhd_response_check_frozen_freeze(): fixed assert, Admin, 2025/06/06
- [libmicrohttpd2] 01/12: Added missing includes for "mhd_assert.h", sorted some includes, Admin, 2025/06/06
- [libmicrohttpd2] 04/12: Improved error reporting for the listen socket creation, Admin, 2025/06/06
- [libmicrohttpd2] 06/12: mhd_stream_finish_req_serving(): minor simplification, Admin, 2025/06/06
- [libmicrohttpd2] 05/12: perf_replies: muted compiler warning, Admin, 2025/06/06
- [libmicrohttpd2] 02/12: Unified debug macro checks,
Admin <=
- [libmicrohttpd2] 09/12: Added detection and used "externally_visible" function attribute, Admin, 2025/06/06
- [libmicrohttpd2] 07/12: mhd_atomic_counter: fixed formatting, fixed single thread version build, Admin, 2025/06/06
- [libmicrohttpd2] 08/12: configure: improved test for alignof() detection, Admin, 2025/06/06
- [libmicrohttpd2] 10/12: Implemented and used counters based on atomic variables, Admin, 2025/06/06
- [libmicrohttpd2] 12/12: get_all_net_updates_by_epoll(): reduced the size of the data passed to the kernel, Admin, 2025/06/06
- [libmicrohttpd2] 11/12: Made zeroing of memory pool optional, other memory pool improvements, Admin, 2025/06/06