gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] branch master updated (d5993f6c -> 7131f387)


From: gnunet
Subject: [libmicrohttpd] branch master updated (d5993f6c -> 7131f387)
Date: Sun, 31 Oct 2021 17:02:42 +0100

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from d5993f6c MHD_queue_response(): restored behavior with wrong parameters
     new 079dfd2c MHD_get_timeout(): improved doxy
     new 9d142ff1 microhttpd.h: fixed code style
     new 55f059ee Sync doxy header and source
     new ed87ddd2 mhd_bithelpers: unified _MHD_ROTx32() behavior
     new f40ddb9e memorypool: improved macros for manual poisoning
     new 528d96de memorypool: fixed code style
     new 7131f387 memorypool: minor code improvments

The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/include/microhttpd.h        |  9 +++++----
 src/microhttpd/daemon.c         | 22 +++++++++++-----------
 src/microhttpd/memorypool.c     | 30 ++++++++++++++----------------
 src/microhttpd/mhd_bithelpers.h |  5 ++---
 4 files changed, 32 insertions(+), 34 deletions(-)

diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 2b7b68e6..9fece2e5 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -2851,12 +2851,13 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon,
  *
  * In practice, if #MHD_YES is returned then #MHD_run() (or
  * #MHD_run_from_select()) must be called not later than @a timeout
- * millisecond.
+ * millisecond even if not activity is detected on sockets by
+ * sockets polling function.
  *
  * @param daemon daemon to query for timeout
  * @param timeout set to the timeout (in milliseconds)
  * @return #MHD_YES on success, #MHD_NO if timeouts are
- *         not used and no data is pending.
+ *         not used and no data processing is pending.
  * @ingroup event
  */
 _MHD_EXTERN enum MHD_Result
@@ -4212,7 +4213,7 @@ MHD_queue_auth_fail_response (struct MHD_Connection 
*connection,
  */
 _MHD_EXTERN char *
 MHD_basic_auth_get_username_password (struct MHD_Connection *connection,
-                                      char**password);
+                                      char **password);
 
 
 /**
@@ -4357,7 +4358,7 @@ MHD_get_daemon_info (struct MHD_Daemon *daemon,
  * @return static version string, e.g. "0.9.9"
  * @ingroup specialized
  */
-_MHD_EXTERN const char*
+_MHD_EXTERN const char *
 MHD_get_version (void);
 
 
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 8fae1c64..0ff7bffc 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -3818,29 +3818,29 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
  * function (`select()`, `poll()` or epoll) should at most block, not the
  * timeout value set for connections.
  *
- * Any external polling function must be called with the timeout value
- * provided by this function. Smaller timeout values can be used for polling
- * function if it is required for any reason, but using larger timeout value
- * or no timeout (indefinite timeout) when this function return #MHD_YES
- * will break MHD processing logic and result in "hung" connections with
- * data pending in network buffers and other problems.
+ * Any "external" sockets polling function must be called with the timeout
+ * value provided by this function. Smaller timeout values can be used for
+ * polling function if it is required for any reason, but using larger
+ * timeout value or no timeout (indefinite timeout) when this function
+ * return #MHD_YES will break MHD processing logic and result in "hung"
+ * connections with data pending in network buffers and other problems.
  *
- * It is important to always use this function when external polling is
+ * It is important to always use this function when "external" polling is
  * used. If this function returns #MHD_YES then #MHD_run() (or
  * #MHD_run_from_select()) must be called right after return from polling
  * function, regardless of the states of MHD fds.
  *
  * In practice, if #MHD_YES is returned then #MHD_run() (or
  * #MHD_run_from_select()) must be called not later than @a timeout
- * millisecond.
+ * millisecond even if not activity is detected on sockets by
+ * sockets polling function.
  * @remark To be called only from thread that process
  * daemon's select()/poll()/etc.
  *
  * @param daemon daemon to query for timeout
  * @param timeout set to the timeout (in milliseconds)
  * @return #MHD_YES on success, #MHD_NO if timeouts are
- *        not used (or no connections exist that would
- *        necessitate the use of a timeout right now).
+ *         not used and no data processing is pending.
  * @ingroup event
  */
 enum MHD_Result
@@ -5203,7 +5203,7 @@ MHD_run (struct MHD_Daemon *daemon)
  * This function calls MHD_get_timeout() internally and use returned value as
  * maximum wait time if it less than value of @a millisec parameter.
  *
- * It is expected that the external socket polling function is not used in
+ * It is expected that the "external" socket polling function is not used in
  * conjunction with this function unless the @a millisec is set to zero.
  *
  * @param daemon the daemon to run
diff --git a/src/microhttpd/memorypool.c b/src/microhttpd/memorypool.c
index 4002e59e..4eae9618 100644
--- a/src/microhttpd/memorypool.c
+++ b/src/microhttpd/memorypool.c
@@ -100,8 +100,8 @@
 #define _MHD_NOSANITIZE_PTRS /**/
 #define _MHD_RED_ZONE_SIZE (0)
 #define ROUND_TO_ALIGN_PLUS_RED_ZONE(n) ROUND_TO_ALIGN(n)
-#define _MHD_POISON_MEMORY(pointer, size) /**/
-#define _MHD_UNPOISON_MEMORY(pointer, size) /**/
+#define _MHD_POISON_MEMORY(pointer, size) (void)0
+#define _MHD_UNPOISON_MEMORY(pointer, size) (void)0
 #else  /* MHD_ASAN_POISON_ACTIVE */
 #if defined(FUNC_ATTR_PTRCOMPARE_WOKRS)
 #define _MHD_NOSANITIZE_PTRS \
@@ -333,8 +333,7 @@ MHD_pool_allocate (struct MemoryPool *pool,
   asize = ROUND_TO_ALIGN_PLUS_RED_ZONE (size);
   if ( (0 == asize) && (0 != size) )
     return NULL; /* size too close to SIZE_MAX */
-  if ( (pool->pos + asize > pool->end) ||
-       (pool->pos + asize < pool->pos))
+  if (asize > pool->end - pool->pos)
     return NULL;
   if (from_end)
   {
@@ -386,8 +385,7 @@ MHD_pool_try_alloc (struct MemoryPool *pool,
     *required_bytes = SIZE_MAX;
     return NULL;
   }
-  if ( (pool->pos + asize > pool->end) ||
-       (pool->pos + asize < pool->pos))
+  if (asize > pool->end - pool->pos)
   {
     mhd_assert ((pool->end - pool->pos) == \
                 ROUND_TO_ALIGN (pool->end - pool->pos));
@@ -434,28 +432,28 @@ MHD_pool_reallocate (struct MemoryPool *pool,
   mhd_assert (pool->size >= pool->end - pool->pos);
   mhd_assert (old != NULL || old_size == 0);
   mhd_assert (pool->size >= old_size);
-  mhd_assert (old == NULL || pool->memory <= (uint8_t*) old);
+  mhd_assert (old == NULL || pool->memory <= (uint8_t *) old);
   /* (old == NULL || pool->memory + pool->size >= (uint8_t*) old + old_size) */
   mhd_assert (old == NULL || \
               (pool->size - _MHD_RED_ZONE_SIZE) >= \
-              (((size_t) (((uint8_t*) old) - pool->memory)) + old_size));
+              (((size_t) (((uint8_t *) old) - pool->memory)) + old_size));
   /* Blocks "from the end" must not be reallocated */
   /* (old == NULL || old_size == 0 || pool->memory + pool->pos > (uint8_t*) 
old) */
   mhd_assert (old == NULL || old_size == 0 || \
-              pool->pos > (size_t) ((uint8_t*) old - pool->memory));
+              pool->pos > (size_t) ((uint8_t *) old - pool->memory));
   mhd_assert (old == NULL || old_size == 0 || \
-              (size_t) (((uint8_t*) old) - pool->memory) + old_size <= \
+              (size_t) (((uint8_t *) old) - pool->memory) + old_size <= \
               pool->end - _MHD_RED_ZONE_SIZE);
 
   if (NULL != old)
   {   /* Have previously allocated data */
-    const size_t old_offset = (uint8_t*) old - pool->memory;
+    const size_t old_offset = (uint8_t *) old - pool->memory;
     const bool shrinking = (old_size > new_size);
     /* Try resizing in-place */
     if (shrinking)
     {     /* Shrinking in-place, zero-out freed part */
-      memset ((uint8_t*) old + new_size, 0, old_size - new_size);
-      _MHD_POISON_MEMORY ((uint8_t*) old + new_size, old_size - new_size);
+      memset ((uint8_t *) old + new_size, 0, old_size - new_size);
+      _MHD_POISON_MEMORY ((uint8_t *) old + new_size, old_size - new_size);
     }
     if (pool->pos ==
         ROUND_TO_ALIGN_PLUS_RED_ZONE (old_offset + old_size))
@@ -523,11 +521,11 @@ MHD_pool_reset (struct MemoryPool *pool,
   mhd_assert (copy_bytes <= new_size);
   mhd_assert (copy_bytes <= pool->size);
   mhd_assert (keep != NULL || copy_bytes == 0);
-  mhd_assert (keep == NULL || pool->memory <= (uint8_t*) keep);
+  mhd_assert (keep == NULL || pool->memory <= (uint8_t *) keep);
   /* (keep == NULL || pool->memory + pool->size >= (uint8_t*) keep + 
copy_bytes) */
   mhd_assert (keep == NULL || \
               pool->size >= \
-              ((size_t) ((uint8_t*) keep - pool->memory)) + copy_bytes);
+              ((size_t) ((uint8_t *) keep - pool->memory)) + copy_bytes);
   _MHD_UNPOISON_MEMORY (pool->memory, new_size);
   if ( (NULL != keep) &&
        (keep != pool->memory) )
@@ -575,7 +573,7 @@ MHD_pool_reset (struct MemoryPool *pool,
   }
   pool->pos = ROUND_TO_ALIGN_PLUS_RED_ZONE (new_size);
   pool->end = pool->size;
-  _MHD_POISON_MEMORY (((uint8_t*) pool->memory) + new_size, \
+  _MHD_POISON_MEMORY (((uint8_t *) pool->memory) + new_size, \
                       pool->size - new_size);
   return pool->memory;
 }
diff --git a/src/microhttpd/mhd_bithelpers.h b/src/microhttpd/mhd_bithelpers.h
index 8f7058a8..ed0c2e0c 100644
--- a/src/microhttpd/mhd_bithelpers.h
+++ b/src/microhttpd/mhd_bithelpers.h
@@ -33,7 +33,6 @@
 /* Declarations for VC & Clang/C2 built-ins */
 #include <intrin.h>
 #endif /* _MSC_FULL_VER  */
-#include "mhd_assert.h"
 #include "mhd_byteorder.h"
 #if _MHD_BYTE_ORDER == _MHD_LITTLE_ENDIAN || _MHD_BYTE_ORDER == _MHD_BIG_ENDIAN
 #include "mhd_align.h"
@@ -293,7 +292,7 @@ _MHD_PUT_64BIT_BE_SAFE (void *dst, uint64_t value)
 _MHD_static_inline uint32_t
 _MHD_ROTR32 (uint32_t value32, int bits)
 {
-  mhd_assert (bits < 32);
+  bits %= 32;
   /* Defined in form which modern compiler could optimize. */
   return (value32 >> bits) | (value32 << (32 - bits));
 }
@@ -321,7 +320,7 @@ _MHD_ROTR32 (uint32_t value32, int bits)
 _MHD_static_inline uint32_t
 _MHD_ROTL32 (uint32_t value32, int bits)
 {
-  mhd_assert (bits < 32);
+  bits %= 32;
   /* Defined in form which modern compiler could optimize. */
   return (value32 << bits) | (value32 >> (32 - bits));
 }

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]