libmicrohttpd2

HTTP server C library (MHD 2.x, alpha)
Log | Files | Refs | README | LICENSE

commit 10a9b46ee7bb5549b721e8aab09f369c956dd5fe
parent f62f8473390b173b386dea8a3ad62360f4429c12
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date:   Thu, 27 Aug 2026 16:17:35 +0200

Public headers: corrected descriptions for HD_FN_PURE_ and MHD_FN_CONST_

Diffstat:
Msrc/include/microhttpd2_portability.h | 23++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/include/microhttpd2_portability.h b/src/include/microhttpd2_portability.h @@ -633,13 +633,15 @@ * the header */ # if __has_attribute (pure) && !defined(MHD_FN_PURE_) /** - * MHD_FN_PURE_ functions always return the same value for this same input - * if volatile memory content is not changed. - * In general, such functions must must not access any global variables that - * can be changed over the time. + * MHD_FN_PURE_ functions have no observable side effects and always return + * the same value for the same input while the ordinary memory they read is + * unchanged. + * Such functions may read ordinary memory, including pointer parameters or + * global variables, but must not write memory, use volatile accesses, perform + * I/O, or depend on state changes not visible as ordinary memory. * Typical examples: * size_t strlen(const char *str); - * int memcmpconst void *ptr1, const void *ptr2, size_t _Size); + * int memcmp(const void *ptr1, const void *ptr2, size_t size); */ # define MHD_FN_PURE_ __attribute__ ((pure)) # endif /* pure && !MHD_FN_PURE_ */ @@ -649,12 +651,11 @@ # if !defined(MHD_FN_CONST_) # if __has_attribute (const) /** - * MHD_FN_CONST_ functions always return the same value for this same - * input value, even if any memory pointed by parameter is changed or - * any global value changed. The functions do not change any global values. - * In general, such functions must not dereference any pointers provided - * as a parameter and must not access any global variables that can be - * changed over the time. + * MHD_FN_CONST_ functions always return the same value for the same input + * values, even if mutable memory elsewhere changes. Such functions may read + * immutable objects, such as static const lookup tables, but must not read + * caller-provided or otherwise mutable memory. + * The functions must not change any global values. * Typical examples: * int square(int x); * int sum(int a, int b);