commit 643ecec0627e69f5c51a38cccb4d38568b0ed07c
parent b1b74560e8a0328da4b1b485a5107b54a41c6450
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date: Sat, 27 Jun 2026 18:19:28 +0200
post_parser_funcs: added "assume" to check value in debug builds and help compiler to optimise
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/mhd2/post_parser_funcs.c b/src/mhd2/post_parser_funcs.c
@@ -49,6 +49,7 @@
#include "mhd_assert.h"
#include "mhd_unreachable.h"
+#include "mhd_assume.h"
#include "mhd_post_parser.h"
@@ -2888,6 +2889,7 @@ check_post_leftovers_mpart (struct MHD_Connection *restrict c,
not_terminated = true;
add_field = true;
value_pos = mf->f.value_idx;
+ mhd_ASSUME (pos >= value_pos);
value_len = pos - value_pos;
break;
case mhd_POST_MPART_ST_DELIM_FOUND:
@@ -2899,6 +2901,7 @@ check_post_leftovers_mpart (struct MHD_Connection *restrict c,
if (0 != mf->f.value_idx)
{
value_pos = mf->f.value_idx;
+ mhd_ASSUME (mf->delim_check_start >= mf->f.value_idx);
value_len = mf->delim_check_start - mf->f.value_idx;
}
break;