[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd2] 08/21: mhd_str: added functions attributes, fixed doxy,
From: |
Admin |
Subject: |
[libmicrohttpd2] 08/21: mhd_str: added functions attributes, fixed doxy, removed extra checks in functions |
Date: |
Fri, 13 Jun 2025 23:38:16 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd2.
commit 93cc9c961f384bd541d148d2798679d41a2bd64a
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
AuthorDate: Thu Jun 12 17:40:56 2025 +0200
mhd_str: added functions attributes, fixed doxy, removed extra checks in
functions
---
src/mhd2/mhd_str.c | 179 ++++++++++++++++++++++++-----------------------------
src/mhd2/mhd_str.h | 120 +++++++++++++++++++++++------------
2 files changed, 160 insertions(+), 139 deletions(-)
diff --git a/src/mhd2/mhd_str.c b/src/mhd2/mhd_str.c
index f6f3589..f15bb78 100644
--- a/src/mhd2/mhd_str.c
+++ b/src/mhd2/mhd_str.c
@@ -59,7 +59,7 @@
* @param c character to check
* @return non-zero if character is lower case letter, zero otherwise
*/
-MHD_static_inline_ bool
+MHD_static_inline_ MHD_FN_CONST_ bool
isasciilower (char c)
{
return (c >= 'a') && (c <= 'z');
@@ -75,7 +75,7 @@ isasciilower (char c)
* @param c character to check
* @return non-zero if character is upper case letter, zero otherwise
*/
-MHD_static_inline_ bool
+MHD_static_inline_ MHD_FN_CONST_ bool
isasciiupper (char c)
{
return (c <= 'Z') && (c >= 'A');
@@ -89,7 +89,7 @@ isasciiupper (char c)
* @param c character to check
* @return non-zero if character is letter in US-ASCII, zero otherwise
*/
-MHD_static_inline_ bool
+MHD_static_inline_ MHD_FN_CONST_ bool
isasciialpha (char c)
{
return isasciilower (c) || isasciiupper (c);
@@ -105,7 +105,7 @@ isasciialpha (char c)
* @param c character to check
* @return non-zero if character is decimal digit, zero otherwise
*/
-MHD_static_inline_ bool
+MHD_static_inline_ MHD_FN_CONST_ bool
isasciidigit (char c)
{
return (c <= '9') && (c >= '0');
@@ -119,7 +119,7 @@ isasciidigit (char c)
* @param c character to check
* @return non-zero if character is decimal digit, zero otherwise
*/
-MHD_static_inline_ bool
+MHD_static_inline_ MHD_FN_CONST_ bool
isasciixdigit (char c)
{
return isasciidigit (c) ||
@@ -134,7 +134,7 @@ isasciixdigit (char c)
* @param c character to check
* @return non-zero if character is decimal digit or letter, zero otherwise
*/
-MHD_static_inline_ bool
+MHD_static_inline_ MHD_FN_CONST_ bool
isasciialnum (char c)
{
return isasciialpha (c) || isasciidigit (c);
@@ -154,7 +154,7 @@ isasciialnum (char c)
* @param c character to convert
* @return converted to lower case character
*/
-MHD_static_inline_ char
+MHD_static_inline_ MHD_FN_CONST_ char
toasciilower (char c)
{
return isasciiupper (c) ? (c - 'A' + 'a') : c;
@@ -170,7 +170,7 @@ toasciilower (char c)
* @param c character to convert
* @return converted to upper case character
*/
-MHD_static_inline_ char
+MHD_static_inline_ MHD_FN_CONST_ char
toasciiupper (char c)
{
return isasciilower (c) ? (c - 'a' + 'A') : c;
@@ -187,7 +187,7 @@ toasciiupper (char c)
* @param c character to convert
* @return value of decimal digit or -1 if @ c is not decimal digit
*/
-MHD_static_inline_ int
+MHD_static_inline_ MHD_FN_CONST_ int
todigitvalue (char c)
{
if (isasciidigit (c))
@@ -206,7 +206,7 @@ todigitvalue (char c)
* @param c character to convert
* @return value of hexadecimal digit or -1 if @ c is not hexadecimal digit
*/
-MHD_static_inline_ int
+MHD_static_inline_ MHD_FN_CONST_ int
xdigittovalue (char c)
{
const unsigned char uc = (unsigned char) c; /* Force unsigned value */
@@ -491,7 +491,7 @@ xdigittovalue (char c)
* @param v the value to convert, must be less then 16
* @return hexadecimal digit
*/
-MHD_static_inline_ char
+MHD_static_inline_ MHD_FN_CONST_ char
valuetoxdigit (unsigned int v)
{
#if ! defined(MHD_FAVOR_SMALL_CODE)
@@ -520,7 +520,7 @@ valuetoxdigit (unsigned int v)
* @param c2 the second char to compare
* @return boolean 'true' if chars are caseless equal, false otherwise
*/
-MHD_static_inline_ bool
+MHD_static_inline_ MHD_FN_CONST_ bool
charsequalcaseless (const char c1, const char c2)
{
return ( (c1 == c2) ||
@@ -684,7 +684,8 @@ static const char map_value_to_xdigit[16] =
#ifndef MHD_FAVOR_SMALL_CODE
-MHD_INTERNAL bool
+MHD_INTERNAL MHD_FN_PURE_ MHD_FN_PAR_NONNULL_ALL_
+MHD_FN_PAR_CSTR_ (1) MHD_FN_PAR_CSTR_ (2) bool
mhd_str_equal_caseless (const char *str1,
const char *str2)
{
@@ -707,7 +708,8 @@ mhd_str_equal_caseless (const char *str1,
#endif /* ! MHD_FAVOR_SMALL_CODE */
-MHD_INTERNAL bool
+MHD_INTERNAL MHD_FN_PURE_ MHD_FN_PAR_NONNULL_ALL_
+MHD_FN_PAR_IN_ (1) MHD_FN_PAR_IN_ (2) bool
mhd_str_equal_caseless_n (const char *const str1,
const char *const str2,
size_t maxlen)
@@ -729,7 +731,8 @@ mhd_str_equal_caseless_n (const char *const str1,
}
-MHD_INTERNAL bool
+MHD_INTERNAL MHD_FN_PURE_ MHD_FN_PAR_NONNULL_ALL_
+MHD_FN_PAR_IN_ (1) MHD_FN_PAR_IN_ (2) bool
mhd_str_equal_caseless_bin_n (const char *const str1,
const char *const str2,
size_t len)
@@ -749,7 +752,9 @@ mhd_str_equal_caseless_bin_n (const char *const str1,
}
-MHD_INTERNAL bool
+MHD_INTERNAL MHD_FN_PURE_ MHD_FN_PAR_NONNULL_ALL_
+MHD_FN_PAR_CSTR_ (1)
+MHD_FN_PAR_IN_ (1) MHD_FN_PAR_IN_ (2) bool
mhd_str_has_token_caseless (const char *restrict str,
const char *const restrict token,
size_t token_len)
@@ -796,7 +801,9 @@ mhd_str_has_token_caseless (const char *restrict str,
}
-MHD_INTERNAL bool
+MHD_INTERNAL MHD_FN_PAR_NONNULL_ALL_
+MHD_FN_PAR_IN_SIZE_ (1,2) MHD_FN_PAR_IN_SIZE_ (3,4)
+MHD_FN_PAR_OUT_ (5) MHD_FN_PAR_INOUT_ (6) bool
mhd_str_remove_token_caseless (const char *restrict str,
size_t str_len,
const char *const restrict token,
@@ -949,7 +956,9 @@ mhd_str_remove_token_caseless (const char *restrict str,
}
-MHD_INTERNAL bool
+MHD_INTERNAL MHD_FN_PAR_NONNULL_ALL_
+MHD_FN_PAR_INOUT_ (1) MHD_FN_PAR_INOUT_ (2)
+MHD_FN_PAR_IN_SIZE_ (3,4) bool
mhd_str_remove_tokens_caseless (char *restrict str,
size_t *restrict str_len,
const char *const restrict tkns,
@@ -1101,14 +1110,16 @@ mhd_str_remove_tokens_caseless (char *restrict str,
#ifndef MHD_FAVOR_SMALL_CODE
/* Use individual function for each case */
-MHD_INTERNAL size_t
+MHD_INTERNAL MHD_FN_PAR_NONNULL_ALL_
+MHD_FN_PAR_CSTR_ (1) MHD_FN_PAR_IN_ (1)
+MHD_FN_PAR_OUT_ (2) size_t
mhd_str_to_uint64 (const char *restrict str,
uint_fast64_t *restrict out_val)
{
const char *const start = str;
uint_fast64_t res;
- if (! str || ! out_val || ! isasciidigit (str[0]))
+ if (! isasciidigit (str[0]))
return 0;
res = 0;
@@ -1132,7 +1143,9 @@ mhd_str_to_uint64 (const char *restrict str,
}
-MHD_INTERNAL size_t
+MHD_INTERNAL MHD_FN_PAR_NONNULL_ALL_
+MHD_FN_PAR_IN_SIZE_ (1,2)
+MHD_FN_PAR_OUT_ (3) size_t
mhd_str_to_uint64_n (const char *restrict str,
size_t maxlen,
uint_fast64_t *restrict out_val)
@@ -1140,7 +1153,7 @@ mhd_str_to_uint64_n (const char *restrict str,
uint_fast64_t res;
size_t i;
- if (! str || ! maxlen || ! out_val || ! isasciidigit (str[0]))
+ if (! maxlen || ! isasciidigit (str[0]))
return 0;
res = 0;
@@ -1165,7 +1178,9 @@ mhd_str_to_uint64_n (const char *restrict str,
}
-MHD_INTERNAL size_t
+MHD_INTERNAL MHD_FN_PAR_NONNULL_ALL_
+MHD_FN_PAR_CSTR_ (1)
+MHD_FN_PAR_IN_ (1) MHD_FN_PAR_OUT_ (2) size_t
mhd_strx_to_uint32 (const char *restrict str,
uint_fast32_t *restrict out_val)
{
@@ -1173,9 +1188,6 @@ mhd_strx_to_uint32 (const char *restrict str,
uint_fast32_t res;
int digit;
- if (! str || ! out_val)
- return 0;
-
res = 0;
digit = xdigittovalue (*str);
while (digit >= 0)
@@ -1199,7 +1211,9 @@ mhd_strx_to_uint32 (const char *restrict str,
}
-MHD_INTERNAL size_t
+MHD_INTERNAL MHD_FN_PAR_NONNULL_ALL_
+MHD_FN_PAR_IN_SIZE_ (1,2)
+MHD_FN_PAR_OUT_ (3) size_t
mhd_strx_to_uint32_n (const char *restrict str,
size_t maxlen,
uint_fast32_t *restrict out_val)
@@ -1207,8 +1221,6 @@ mhd_strx_to_uint32_n (const char *restrict str,
size_t i;
uint_fast32_t res;
int digit;
- if (! str || ! out_val)
- return 0;
res = 0;
i = 0;
@@ -1234,25 +1246,15 @@ mhd_strx_to_uint32_n (const char *restrict str,
}
-/**
- * Convert hexadecimal US-ASCII digits in string to number in uint_fast64_t.
- * Conversion stopped at first non-digit character.
- *
- * @param str string to convert
- * @param[out] out_val pointer to uint_fast64_t to store result of conversion
- * @return non-zero number of characters processed on succeed,
- * zero if no digit is found, resulting value is larger
- * then possible to store in uint_fast64_t or @a out_val is NULL
- */
-MHD_INTERNAL size_t
+MHD_INTERNAL MHD_FN_PAR_NONNULL_ALL_
+MHD_FN_PAR_CSTR_ (1)
+MHD_FN_PAR_IN_ (1) MHD_FN_PAR_OUT_ (2) size_t
mhd_strx_to_uint64 (const char *restrict str,
uint_fast64_t *restrict out_val)
{
const char *const start = str;
uint_fast64_t res;
int digit;
- if (! str || ! out_val)
- return 0;
res = 0;
digit = xdigittovalue (*str);
@@ -1277,20 +1279,9 @@ mhd_strx_to_uint64 (const char *restrict str,
}
-/**
- * Convert not more then @a maxlen hexadecimal US-ASCII digits in string
- * to number in uint_fast64_t.
- * Conversion stopped at first non-digit character or after @a maxlen
- * digits.
- *
- * @param str string to convert
- * @param maxlen maximum number of characters to process
- * @param[out] out_val pointer to uint_fast64_t to store result of conversion
- * @return non-zero number of characters processed on succeed,
- * zero if no digit is found, resulting value is larger
- * then possible to store in uint_fast64_t or @a out_val is NULL
- */
-MHD_INTERNAL size_t
+MHD_INTERNAL MHD_FN_PAR_NONNULL_ALL_
+MHD_FN_PAR_IN_SIZE_ (1,2)
+MHD_FN_PAR_OUT_ (3) size_t
mhd_strx_to_uint64_n (const char *restrict str,
size_t maxlen,
uint_fast64_t *restrict out_val)
@@ -1298,8 +1289,6 @@ mhd_strx_to_uint64_n (const char *restrict str,
size_t i;
uint_fast64_t res;
int digit;
- if (! str || ! out_val)
- return 0;
res = 0;
i = 0;
@@ -1324,24 +1313,8 @@ mhd_strx_to_uint64_n (const char *restrict str,
#else /* MHD_FAVOR_SMALL_CODE */
-/**
- * Generic function for converting not more then @a maxlen
- * hexadecimal or decimal US-ASCII digits in string to number.
- * Conversion stopped at first non-digit character or after @a maxlen
- * digits.
- * To be used only within macro.
- *
- * @param str the string to convert
- * @param maxlen the maximum number of characters to process
- * @param out_val the pointer to variable to store result of conversion
- * @param val_size the size of variable pointed by @a out_val, in bytes, 4 or 8
- * @param max_val the maximum decoded number
- * @param base the numeric base, 10 or 16
- * @return non-zero number of characters processed on succeed,
- * zero if no digit is found, resulting value is larger
- * then @a max_val, @a val_size is not 4/8 or @a out_val is NULL
- */
-MHD_INTERNAL size_t
+MHD_INTERNAL MHD_FN_PAR_NONNULL_ALL_
+MHD_FN_PAR_IN_SIZE_ (1,2) MHD_FN_PAR_OUT_SIZE_ (3,4) size_t
mhd_str_to_uvalue_n (const char *restrict str,
size_t maxlen,
void *restrict out_val,
@@ -1354,8 +1327,7 @@ mhd_str_to_uvalue_n (const char *restrict str,
const uint_fast64_t max_v_div_b = max_val / base;
const uint_fast64_t max_v_mod_b = max_val % base;
- if (! str || ! out_val ||
- ((base != 16) && (base != 10)) )
+ if ((base != 16) && (base != 10))
return 0;
res = 0;
@@ -1393,7 +1365,8 @@ mhd_str_to_uvalue_n (const char *restrict str,
#endif /* MHD_FAVOR_SMALL_CODE */
-MHD_INTERNAL size_t
+MHD_INTERNAL MHD_FN_PAR_NONNULL_ALL_
+MHD_FN_PAR_OUT_SIZE_ (2,3) size_t
mhd_uint32_to_strx (uint_fast32_t val,
char *buf,
size_t buf_size)
@@ -1427,7 +1400,8 @@ mhd_uint32_to_strx (uint_fast32_t val,
#ifndef MHD_FAVOR_SMALL_CODE
-MHD_INTERNAL size_t
+MHD_INTERNAL MHD_FN_PAR_NONNULL_ALL_
+MHD_FN_PAR_OUT_SIZE_ (2,3) size_t
mhd_uint16_to_str (uint_least16_t val,
char *buf,
size_t buf_size)
@@ -1469,7 +1443,8 @@ mhd_uint16_to_str (uint_least16_t val,
#endif /* !MHD_FAVOR_SMALL_CODE */
-MHD_INTERNAL size_t
+MHD_INTERNAL MHD_FN_PAR_NONNULL_ALL_
+MHD_FN_PAR_OUT_SIZE_ (2,3) size_t
mhd_uint64_to_str (uint_fast64_t val,
char *buf,
size_t buf_size)
@@ -1508,7 +1483,8 @@ mhd_uint64_to_str (uint_fast64_t val,
}
-MHD_INTERNAL size_t
+MHD_INTERNAL MHD_FN_PAR_NONNULL_ALL_
+MHD_FN_PAR_OUT_SIZE_ (3,4) size_t
mhd_uint8_to_str_pad (uint8_t val,
uint8_t min_digits,
char *buf,
@@ -1517,8 +1493,6 @@ mhd_uint8_to_str_pad (uint8_t val,
size_t pos; /**< the position of the current printed digit */
int digit;
mhd_assert (3 >= min_digits);
- if (0 == buf_size)
- return 0;
pos = 0;
digit = val / 100;
@@ -1588,7 +1562,8 @@ mhd_bin_to_hex_z (const void *restrict bin,
}
-MHD_INTERNAL size_t
+MHD_INTERNAL MHD_FN_PAR_NONNULL_ALL_
+MHD_FN_PAR_IN_SIZE_ (1,2) MHD_FN_PAR_OUT_ (3) size_t
mhd_hex_to_bin (const char *restrict hex,
size_t len,
void *restrict bin)
@@ -1596,8 +1571,6 @@ mhd_hex_to_bin (const char *restrict hex,
size_t r;
size_t w;
- if (0 == len)
- return 0;
r = 0;
w = 0;
if (0 != len % 2)
@@ -1627,7 +1600,8 @@ mhd_hex_to_bin (const char *restrict hex,
}
-MHD_INTERNAL size_t
+MHD_INTERNAL MHD_FN_PAR_NONNULL_ALL_
+MHD_FN_PAR_IN_SIZE_ (1,2) MHD_FN_PAR_OUT_SIZE_ (3,4) size_t
mhd_str_pct_decode_strict_n (const char *pct_encoded,
size_t pct_encoded_len,
char *decoded,
@@ -1714,7 +1688,9 @@ mhd_str_pct_decode_strict_n (const char *pct_encoded,
}
-MHD_INTERNAL size_t
+MHD_INTERNAL
+MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_NONNULL_ (3)
+MHD_FN_PAR_IN_SIZE_ (1,2) MHD_FN_PAR_OUT_SIZE_ (3,4) size_t
mhd_str_pct_decode_lenient_n (const char *pct_encoded,
size_t pct_encoded_len,
char *decoded,
@@ -1819,7 +1795,8 @@ mhd_str_pct_decode_lenient_n (const char *pct_encoded,
}
-MHD_INTERNAL size_t
+MHD_INTERNAL MHD_FN_PAR_NONNULL_ALL_
+MHD_FN_PAR_CSTR_ (1) size_t
mhd_str_pct_decode_in_place_strict (char *str)
{
#ifdef MHD_FAVOR_SMALL_CODE
@@ -1876,7 +1853,8 @@ mhd_str_pct_decode_in_place_strict (char *str)
}
-MHD_INTERNAL size_t
+MHD_INTERNAL
+MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_CSTR_ (1) size_t
mhd_str_pct_decode_in_place_lenient (char *restrict str,
bool *restrict broken_encoding)
{
@@ -1954,7 +1932,9 @@ mhd_str_pct_decode_in_place_lenient (char *restrict str,
#ifdef MHD_SUPPORT_AUTH_DIGEST
-MHD_INTERNAL bool
+
+MHD_INTERNAL MHD_FN_PURE_ MHD_FN_PAR_NONNULL_ALL_
+MHD_FN_PAR_IN_SIZE_ (1,2) MHD_FN_PAR_IN_SIZE_ (3,4) bool
mhd_str_equal_quoted_bin_n (const char *quoted,
size_t quoted_len,
const char *unquoted,
@@ -1984,7 +1964,8 @@ mhd_str_equal_quoted_bin_n (const char *quoted,
}
-MHD_INTERNAL bool
+MHD_INTERNAL MHD_FN_PURE_ MHD_FN_PAR_NONNULL_ALL_
+MHD_FN_PAR_IN_SIZE_ (1,2) MHD_FN_PAR_IN_SIZE_ (3,4) bool
mhd_str_equal_caseless_quoted_bin_n (const char *quoted,
size_t quoted_len,
const char *unquoted,
@@ -2018,7 +1999,8 @@ mhd_str_equal_caseless_quoted_bin_n (const char *quoted,
#if defined(MHD_SUPPORT_AUTH_DIGEST) || defined(MHD_SUPPORT_POST_PARSER)
-MHD_INTERNAL size_t
+MHD_INTERNAL MHD_FN_PAR_NONNULL_ALL_
+MHD_FN_PAR_IN_SIZE_ (1,2) MHD_FN_PAR_OUT_SIZE_ (3,2) size_t
mhd_str_unquote (const char *quoted,
size_t quoted_len,
char *result)
@@ -2170,7 +2152,8 @@ base64_char_to_value_ (uint8_t c)
mhd_DATA_TRUNCATION_RUNTIME_CHECK_DISABLE
-MHD_INTERNAL size_t
+MHD_INTERNAL MHD_FN_PAR_NONNULL_ALL_
+MHD_FN_PAR_IN_SIZE_ (1,2) MHD_FN_PAR_OUT_SIZE_ (3,4) size_t
mhd_base64_to_bin_n (const char *base64,
size_t base64_len,
void *bin,
@@ -2347,7 +2330,7 @@ mhd_DATA_TRUNCATION_RUNTIME_CHECK_RESTORE
#endif /* MHD_SUPPORT_AUTH_BASIC */
-MHD_INTERNAL MHD_FN_PAR_NONNULL_ALL_ bool
+MHD_INTERNAL MHD_FN_PURE_ MHD_FN_PAR_NONNULL_ALL_ bool
mhd_str_starts_with_token_opt_param (const struct MHD_String *restrict str,
const struct MHD_String *restrict token)
{
@@ -2381,8 +2364,8 @@ mhd_str_starts_with_token_opt_param (const struct
MHD_String *restrict str,
MHD_INTERNAL MHD_FN_PAR_NONNULL_ALL_
-MHD_FN_PAR_OUT_ (4)
-MHD_FN_PAR_OUT_ (5) enum mhd_StingStartsWithTokenResult
+MHD_FN_PAR_IN_ (1) MHD_FN_PAR_IN_ (2) MHD_FN_PAR_IN_ (3)
+MHD_FN_PAR_OUT_ (4) MHD_FN_PAR_OUT_ (5) enum mhd_StingStartsWithTokenResult
mhd_str_starts_with_token_req_param (
const struct MHD_String *restrict str,
const struct MHD_String *restrict token,
diff --git a/src/mhd2/mhd_str.h b/src/mhd2/mhd_str.h
index 312913c..e412935 100644
--- a/src/mhd2/mhd_str.h
+++ b/src/mhd2/mhd_str.h
@@ -55,7 +55,8 @@
*/
MHD_INTERNAL bool
mhd_str_equal_caseless (const char *str1,
- const char *str2);
+ const char *str2)
+MHD_FN_PURE_ MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_CSTR_ (1) MHD_FN_PAR_CSTR_ (2);
#else /* MHD_FAVOR_SMALL_CODE */
/* Reuse mhd_str_equal_caseless_n() to reduce size */
@@ -77,7 +78,8 @@ mhd_str_equal_caseless (const char *str1,
MHD_INTERNAL bool
mhd_str_equal_caseless_n (const char *const str1,
const char *const str2,
- size_t maxlen);
+ size_t maxlen)
+MHD_FN_PURE_ MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_IN_ (1) MHD_FN_PAR_IN_ (2);
/**
@@ -93,7 +95,8 @@ mhd_str_equal_caseless_n (const char *const str1,
MHD_INTERNAL bool
mhd_str_equal_caseless_bin_n (const char *const str1,
const char *const str2,
- size_t len);
+ size_t len)
+MHD_FN_PURE_ MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_IN_ (1) MHD_FN_PAR_IN_ (2);
/**
@@ -130,7 +133,9 @@ mhd_str_equal_caseless_bin_n (const char *const str1,
MHD_INTERNAL bool
mhd_str_has_token_caseless (const char *restrict str,
const char *const restrict token,
- size_t token_len);
+ size_t token_len)
+MHD_FN_PURE_ MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_CSTR_ (1)
+MHD_FN_PAR_IN_ (1) MHD_FN_PAR_IN_ (2);
/**
* Check whether @a str has case-insensitive static @a tkn.
@@ -180,7 +185,9 @@ mhd_str_remove_token_caseless (const char *restrict str,
const char *const restrict token,
const size_t token_len,
char *restrict buf,
- ssize_t *restrict buf_size);
+ ssize_t *restrict buf_size)
+MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_IN_SIZE_ (1,2) MHD_FN_PAR_IN_SIZE_ (3,4)
+MHD_FN_PAR_OUT_ (5) MHD_FN_PAR_INOUT_ (6);
/**
@@ -210,7 +217,9 @@ MHD_INTERNAL bool
mhd_str_remove_tokens_caseless (char *restrict str,
size_t *restrict str_len,
const char *const restrict tkns,
- const size_t tkns_len);
+ const size_t tkns_len)
+MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_INOUT_ (1) MHD_FN_PAR_INOUT_ (2)
+MHD_FN_PAR_IN_SIZE_ (3,4);
#ifndef MHD_FAVOR_SMALL_CODE
@@ -223,12 +232,14 @@ mhd_str_remove_tokens_caseless (char *restrict str,
* @param str string to convert
* @param[out] out_val pointer to uint_fast64_t to store result of conversion
* @return non-zero number of characters processed on succeed,
- * zero if no digit is found, resulting value is larger
- * then possible to store in uint_fast64_t or @a out_val is NULL
+ * zero if no digit is found or resulting value is larger
+ * then possible to store in uint_fast64_t
*/
MHD_INTERNAL size_t
mhd_str_to_uint64 (const char *restrict str,
- uint_fast64_t *restrict out_val);
+ uint_fast64_t *restrict out_val)
+MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_CSTR_ (1) MHD_FN_PAR_IN_ (1)
+MHD_FN_PAR_OUT_ (2);
/**
* Convert not more then @a maxlen decimal US-ASCII digits in string to
@@ -240,13 +251,14 @@ mhd_str_to_uint64 (const char *restrict str,
* @param maxlen maximum number of characters to process
* @param[out] out_val pointer to uint_fast64_t to store result of conversion
* @return non-zero number of characters processed on succeed,
- * zero if no digit is found, resulting value is larger
- * then possible to store in uint_fast64_t or @a out_val is NULL
+ * zero if no digit is found or resulting value is larger
+ * then possible to store in uint_fast64_t
*/
MHD_INTERNAL size_t
mhd_str_to_uint64_n (const char *restrict str,
size_t maxlen,
- uint_fast64_t *restrict out_val);
+ uint_fast64_t *restrict out_val)
+MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_IN_SIZE_ (1,2) MHD_FN_PAR_OUT_ (3);
/**
@@ -256,12 +268,14 @@ mhd_str_to_uint64_n (const char *restrict str,
* @param str string to convert
* @param[out] out_val pointer to uint_fast32_t to store result of conversion
* @return non-zero number of characters processed on succeed,
- * zero if no digit is found, resulting value is larger
- * then possible to store in uint_fast32_t or @a out_val is NULL
+ * zero if no digit is found or resulting value is larger
+ * then possible to store in uint_fast32_t
*/
MHD_INTERNAL size_t
mhd_strx_to_uint32 (const char *restrict str,
- uint_fast32_t *restrict out_val);
+ uint_fast32_t *restrict out_val)
+MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_CSTR_ (1)
+MHD_FN_PAR_IN_ (1) MHD_FN_PAR_OUT_ (2);
/**
@@ -274,13 +288,14 @@ mhd_strx_to_uint32 (const char *restrict str,
* @param maxlen maximum number of characters to process
* @param[out] out_val pointer to uint_fast32_t to store result of conversion
* @return non-zero number of characters processed on succeed,
- * zero if no digit is found, resulting value is larger
- * then possible to store in uint_fast32_t or @a out_val is NULL
+ * zero if no digit is found or resulting value is larger
+ * then possible to store in uint_fast32_t
*/
MHD_INTERNAL size_t
mhd_strx_to_uint32_n (const char *restrict str,
size_t maxlen,
- uint_fast32_t *restrict out_val);
+ uint_fast32_t *restrict out_val)
+MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_IN_SIZE_ (1,2) MHD_FN_PAR_OUT_ (3);
/**
@@ -290,12 +305,14 @@ mhd_strx_to_uint32_n (const char *restrict str,
* @param str string to convert
* @param[out] out_val pointer to uint_fast64_t to store result of conversion
* @return non-zero number of characters processed on succeed,
- * zero if no digit is found, resulting value is larger
- * then possible to store in uint_fast64_t or @a out_val is NULL
+ * zero if no digit is found or resulting value is larger
+ * then possible to store in uint_fast64_t
*/
MHD_INTERNAL size_t
mhd_strx_to_uint64 (const char *restrict str,
- uint_fast64_t *restrict out_val);
+ uint_fast64_t *restrict out_val)
+MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_CSTR_ (1)
+MHD_FN_PAR_IN_ (1) MHD_FN_PAR_OUT_ (2);
/**
@@ -308,13 +325,14 @@ mhd_strx_to_uint64 (const char *restrict str,
* @param maxlen maximum number of characters to process
* @param[out] out_val pointer to uint_fast64_t to store result of conversion
* @return non-zero number of characters processed on succeed,
- * zero if no digit is found, resulting value is larger
- * then possible to store in uint_fast64_t or @a out_val is NULL
+ * zero if no digit is found or resulting value is larger
+ * then possible to store in uint_fast64_t
*/
MHD_INTERNAL size_t
mhd_strx_to_uint64_n (const char *restrict str,
size_t maxlen,
- uint_fast64_t *restrict out_val);
+ uint_fast64_t *restrict out_val)
+MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_IN_SIZE_ (1,2) MHD_FN_PAR_OUT_ (3);
#else /* MHD_FAVOR_SMALL_CODE */
/* Use one universal function and macros to reduce size */
@@ -334,7 +352,8 @@ mhd_strx_to_uint64_n (const char *restrict str,
* @param base the numeric base, 10 or 16
* @return non-zero number of characters processed on succeed,
* zero if no digit is found, resulting value is larger
- * then @a max_val, @a val_size is not 4/8 or @a out_val is NULL
+ * then @a max_val, @a val_size is not 4 or 8
+ * or @a base is not 10 or 16
*/
MHD_INTERNAL size_t
mhd_str_to_uvalue_n (const char *restrict str,
@@ -342,7 +361,8 @@ mhd_str_to_uvalue_n (const char *restrict str,
void *restrict out_val,
size_t val_size,
uint_fast64_t max_val,
- unsigned int base);
+ unsigned int base)
+MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_IN_SIZE_ (1,2) MHD_FN_PAR_OUT_SIZE_ (3,4);
#define mhd_str_to_uint64(s,ov) \
mhd_str_to_uvalue_n ((s),SIZE_MAX,(ov), \
@@ -399,7 +419,8 @@ mhd_str_to_uvalue_n (const char *restrict str,
MHD_INTERNAL size_t
mhd_uint32_to_strx (uint_fast32_t val,
char *buf,
- size_t buf_size);
+ size_t buf_size)
+MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_OUT_SIZE_ (2,3);
#ifndef MHD_FAVOR_SMALL_CODE
@@ -415,7 +436,8 @@ mhd_uint32_to_strx (uint_fast32_t val,
MHD_INTERNAL size_t
mhd_uint16_to_str (uint_least16_t val,
char *buf,
- size_t buf_size);
+ size_t buf_size)
+MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_OUT_SIZE_ (2,3);
#else /* MHD_FAVOR_SMALL_CODE */
#define mhd_uint16_to_str(v,b,s) mhd_uint64_to_str (v,b,s)
@@ -434,7 +456,8 @@ mhd_uint16_to_str (uint_least16_t val,
MHD_INTERNAL size_t
mhd_uint64_to_str (uint_fast64_t val,
char *buf,
- size_t buf_size);
+ size_t buf_size)
+MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_OUT_SIZE_ (2,3);
/**
@@ -456,7 +479,8 @@ MHD_INTERNAL size_t
mhd_uint8_to_str_pad (uint8_t val,
uint8_t min_digits,
char *buf,
- size_t buf_size);
+ size_t buf_size)
+MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_OUT_SIZE_ (3,4);
/**
@@ -505,7 +529,8 @@ MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_IN_SIZE_ (1, 2)
MHD_FN_PAR_OUT_ (3);
MHD_INTERNAL size_t
mhd_hex_to_bin (const char *restrict hex,
size_t len,
- void *restrict bin);
+ void *restrict bin)
+MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_IN_SIZE_ (1,2) MHD_FN_PAR_OUT_ (3);
/**
* Decode string with percent-encoded characters as defined by
@@ -529,7 +554,8 @@ MHD_INTERNAL size_t
mhd_str_pct_decode_strict_n (const char *pct_encoded,
size_t pct_encoded_len,
char *decoded,
- size_t buf_size);
+ size_t buf_size)
+MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_IN_SIZE_ (1,2) MHD_FN_PAR_OUT_SIZE_ (3,4);
/**
* Decode string with percent-encoded characters as defined by
@@ -558,7 +584,9 @@ mhd_str_pct_decode_lenient_n (const char *pct_encoded,
size_t pct_encoded_len,
char *decoded,
size_t buf_size,
- bool *restrict broken_encoding);
+ bool *restrict broken_encoding)
+MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_NONNULL_ (3)
+MHD_FN_PAR_IN_SIZE_ (1,2) MHD_FN_PAR_OUT_SIZE_ (3,4);
/**
@@ -575,7 +603,8 @@ mhd_str_pct_decode_lenient_n (const char *pct_encoded,
* @return the number of character in decoded string
*/
MHD_INTERNAL size_t
-mhd_str_pct_decode_in_place_strict (char *str);
+mhd_str_pct_decode_in_place_strict (char *str)
+MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_CSTR_ (1);
/**
@@ -598,7 +627,8 @@ mhd_str_pct_decode_in_place_strict (char *str);
*/
MHD_INTERNAL size_t
mhd_str_pct_decode_in_place_lenient (char *restrict str,
- bool *restrict broken_encoding);
+ bool *restrict broken_encoding)
+MHD_FN_PAR_NONNULL_ (1) MHD_FN_PAR_CSTR_ (1);
#ifdef MHD_SUPPORT_AUTH_DIGEST
/**
@@ -624,7 +654,9 @@ MHD_INTERNAL bool
mhd_str_equal_quoted_bin_n (const char *quoted,
size_t quoted_len,
const char *unquoted,
- size_t unquoted_len);
+ size_t unquoted_len)
+MHD_FN_PURE_ MHD_FN_PAR_NONNULL_ALL_
+ MHD_FN_PAR_IN_SIZE_ (1,2) MHD_FN_PAR_IN_SIZE_ (3,4);
/**
* Check whether the string after "unquoting" equals static string.
@@ -669,7 +701,9 @@ MHD_INTERNAL bool
mhd_str_equal_caseless_quoted_bin_n (const char *quoted,
size_t quoted_len,
const char *unquoted,
- size_t unquoted_len);
+ size_t unquoted_len)
+MHD_FN_PURE_ MHD_FN_PAR_NONNULL_ALL_
+ MHD_FN_PAR_IN_SIZE_ (1,2) MHD_FN_PAR_IN_SIZE_ (3,4);
/**
* Check whether the string after "unquoting" equals static string, ignoring
@@ -713,7 +747,8 @@ mhd_str_equal_caseless_quoted_bin_n (const char *quoted,
MHD_INTERNAL size_t
mhd_str_unquote (const char *quoted,
size_t quoted_len,
- char *result);
+ char *result)
+MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_IN_SIZE_ (1,2) MHD_FN_PAR_OUT_SIZE_ (3,2);
#endif /* MHD_SUPPORT_AUTH_DIGEST || MHD_SUPPORT_POST_PARSER */
@@ -776,7 +811,8 @@ MHD_INTERNAL size_t
mhd_base64_to_bin_n (const char *base64,
size_t base64_len,
void *bin,
- size_t bin_size);
+ size_t bin_size)
+MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_IN_SIZE_ (1,2) MHD_FN_PAR_OUT_SIZE_ (3,4);
#endif /* MHD_SUPPORT_AUTH_BASIC */
@@ -797,7 +833,7 @@ mhd_base64_to_bin_n (const char *base64,
MHD_INTERNAL bool
mhd_str_starts_with_token_opt_param (const struct MHD_String *restrict str,
const struct MHD_String *restrict token)
-MHD_FN_PAR_NONNULL_ALL_;
+MHD_FN_PURE_ MHD_FN_PAR_NONNULL_ALL_;
/**
@@ -852,6 +888,8 @@ mhd_str_starts_with_token_req_param (
const struct MHD_String *restrict par,
struct mhd_BufferConst *restrict par_value,
bool *restrict par_value_needs_unquote)
-MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_OUT_(4) MHD_FN_PAR_OUT_ (5);
+MHD_FN_PAR_NONNULL_ALL_
+MHD_FN_PAR_IN_(1) MHD_FN_PAR_IN_(2) MHD_FN_PAR_IN_(3)
+MHD_FN_PAR_OUT_(4) MHD_FN_PAR_OUT_ (5);
#endif /* MHD_STR_H */
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd2] 01/21: conn_data_send.c: fixed large sending, added some asserts, (continued)
- [libmicrohttpd2] 01/21: conn_data_send.c: fixed large sending, added some asserts, Admin, 2025/06/13
- [libmicrohttpd2] 04/21: xdigittovalue(): optimised., Admin, 2025/06/13
- [libmicrohttpd2] 18/21: Renamed test_postprocessor -> test_postparser to match API naming, Admin, 2025/06/13
- [libmicrohttpd2] 16/21: configure: minor check improvement, Admin, 2025/06/13
- [libmicrohttpd2] 12/21: mhd_locks: added W32 implementation based on SRW locks (and minor improvements), Admin, 2025/06/13
- [libmicrohttpd2] 10/21: configure: added release build linker flags, Admin, 2025/06/13
- [libmicrohttpd2] 15/21: POST parser: improved parsing performance by storing complete delimiter instead of boundary, Admin, 2025/06/13
- [libmicrohttpd2] 14/21: POST parser: optimised large upload processing, Admin, 2025/06/13
- [libmicrohttpd2] 07/21: daemon_start: cosmetics, fixed code style, Admin, 2025/06/13
- [libmicrohttpd2] 06/21: Fixed compiler warnings, Admin, 2025/06/13
- [libmicrohttpd2] 08/21: mhd_str: added functions attributes, fixed doxy, removed extra checks in functions,
Admin <=
- [libmicrohttpd2] 03/21: bootstrap: English fixes, Admin, 2025/06/13
- [libmicrohttpd2] 05/21: mhd_str.c: minor readability improvements, Admin, 2025/06/13
- [libmicrohttpd2] 20/21: perf_replies: fixed formatting, Admin, 2025/06/13
- [libmicrohttpd2] 19/21: conn_data_send.c: fixed formatting, Admin, 2025/06/13
- [libmicrohttpd2] 17/21: POST parser: accelerate by using memmem() for delimiters, Admin, 2025/06/13