[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 02/02: mhd_str: minor refactoring for compact code
From: |
gnunet |
Subject: |
[libmicrohttpd] 02/02: mhd_str: minor refactoring for compact code |
Date: |
Tue, 27 Sep 2022 19:47:54 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 4153c1cd4c234226f5075e4115606d8fc4549ad4
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Tue Sep 27 20:36:56 2022 +0300
mhd_str: minor refactoring for compact code
---
src/microhttpd/mhd_str.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/microhttpd/mhd_str.c b/src/microhttpd/mhd_str.c
index efe31f12..9c1c5172 100644
--- a/src/microhttpd/mhd_str.c
+++ b/src/microhttpd/mhd_str.c
@@ -1168,12 +1168,8 @@ MHD_str_to_uvalue_n_ (const char *str,
{
size_t i;
uint64_t res;
- int digit;
const uint64_t max_v_div_b = max_val / base;
const uint64_t max_v_mod_b = max_val % base;
- /* 'digit->value' must be function, not macro */
- int (*const dfunc)(char) = (base == 16) ?
- toxdigitvalue : todigitvalue;
if (! str || ! out_val ||
((base != 16) && (base != 10)) )
@@ -1181,8 +1177,13 @@ MHD_str_to_uvalue_n_ (const char *str,
res = 0;
i = 0;
- while (maxlen > i && 0 <= (digit = dfunc (str[i])))
+ while (maxlen > i)
{
+ const int digit = (base == 16) ?
+ toxdigitvalue (str[i]) : todigitvalue (str[i]);
+
+ if (0 > digit)
+ break;
if ( ((max_v_div_b) < res) ||
(( (max_v_div_b) == res) && ( (max_v_mod_b) < (uint64_t) digit) ) )
return 0;
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.