[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 10/10: daemon: muted compiler warning, refactored code f
From: |
gnunet |
Subject: |
[libmicrohttpd] 10/10: daemon: muted compiler warning, refactored code for readability |
Date: |
Tue, 31 May 2022 19:38:19 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 1b8c52f1d0ed637c2a027a5ad86ad497ede8c527
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Tue May 31 20:09:59 2022 +0300
daemon: muted compiler warning, refactored code for readability
---
src/microhttpd/daemon.c | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 3e7131c1..6ac948d9 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -4507,7 +4507,6 @@ MHD_select (struct MHD_Daemon *daemon,
if (MHD_NO != err_state)
millisec = 0;
- tv = NULL;
if (0 == millisec)
{
timeout.tv_usec = 0;
@@ -4516,32 +4515,40 @@ MHD_select (struct MHD_Daemon *daemon,
}
else
{
- uint64_t timeout64;
+ uint64_t mhd_tmo;
+ uint64_t select_tmo;
if ( (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
- (MHD_NO != MHD_get_timeout64 (daemon, &timeout64)) )
+ (MHD_NO != MHD_get_timeout64 (daemon, &mhd_tmo)) )
{
- tv = &timeout; /* have timeout value */
if ( (0 < millisec) &&
- (timeout64 > (uint64_t) millisec) )
- timeout64 = (uint64_t) millisec;
+ (mhd_tmo > (uint64_t) millisec) )
+ select_tmo = (uint64_t) millisec;
+ else
+ select_tmo = mhd_tmo;
+ tv = &timeout; /* have timeout value */
}
else if (0 < millisec)
{
+ select_tmo = (uint64_t) millisec;
tv = &timeout; /* have timeout value */
- timeout64 = (uint64_t) millisec;
+ }
+ else
+ {
+ select_tmo = 0; /* Not actually used, silent compiler warning */
+ tv = NULL;
}
if (NULL != tv)
{ /* have timeout value */
#if (SIZEOF_UINT64_T - 2) >= SIZEOF_STRUCT_TIMEVAL_TV_SEC
- if (timeout64 / 1000 > TIMEVAL_TV_SEC_MAX)
+ if (select_tmo / 1000 > TIMEVAL_TV_SEC_MAX)
timeout.tv_sec = TIMEVAL_TV_SEC_MAX;
else
#endif /* (SIZEOF_UINT64_T - 2) >= SIZEOF_STRUCT_TIMEVAL_TV_SEC */
- timeout.tv_sec = (_MHD_TIMEVAL_TV_SEC_TYPE) (timeout64 / 1000);
+ timeout.tv_sec = (_MHD_TIMEVAL_TV_SEC_TYPE) (select_tmo / 1000);
- timeout.tv_usec = ((uint16_t) (timeout64 % 1000)) * ((int32_t) 1000);
+ timeout.tv_usec = ((uint16_t) (select_tmo % 1000)) * ((int32_t) 1000);
}
}
num_ready = MHD_SYS_select_ (maxsock + 1,
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] branch master updated (afb8ed41 -> 1b8c52f1), gnunet, 2022/05/31
- [libmicrohttpd] 01/10: connection.c: fixed compiler warnings, gnunet, 2022/05/31
- [libmicrohttpd] 02/10: MHD_FIND_ADD_CC_{C,LD}FLAG_IFELSE: added new autoconf macros, gnunet, 2022/05/31
- [libmicrohttpd] 04/10: MHD_get_timeout*(): improved doxy, gnunet, 2022/05/31
- [libmicrohttpd] 05/10: Fixed wrong variable type used for result of gnutls_priority_init(), gnunet, 2022/05/31
- [libmicrohttpd] 06/10: configure: disabled one more warning on clang, gnunet, 2022/05/31
- [libmicrohttpd] 07/10: mhd_sockets: muted compiler warning with very minor optimisation, gnunet, 2022/05/31
- [libmicrohttpd] 08/10: daemon.c: fixed possible uninitialized value, gnunet, 2022/05/31
- [libmicrohttpd] 03/10: configure: added more workarounds for clang, gnunet, 2022/05/31
- [libmicrohttpd] 09/10: Fixed 'int' instead of 'MHD_Result', gnunet, 2022/05/31
- [libmicrohttpd] 10/10: daemon: muted compiler warning, refactored code for readability,
gnunet <=