gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (07829e85 -> 9cb16af3)


From: gnunet
Subject: [libmicrohttpd] branch master updated (07829e85 -> 9cb16af3)
Date: Sun, 24 Oct 2021 13:45:03 +0200

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from 07829e85 test_add_conn: used the better way to mute compiler and 
analyzer warnings
     new 0f6703b9 configure: improved reporting on Solaris
     new c407fe3d configure: fixed harmless typo in cache variable name
     new 66f273f4 Added check at configure time for PAGESIZE and PAGE_SIZE 
macros
     new 18c2ad66 websocket_threaded_example: fixed compiler warning on x32 
platforms
     new 276f601f Fixed: include "MHD_config.h" before other headers to set 
correct macros
     new 9cb16af3 connection.c: fixed copy-paste error in comment

The 6 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:
 configure.ac                              | 83 ++++++++++++++++++++++++++++---
 src/examples/websocket_threaded_example.c | 18 ++++---
 src/microhttpd/connection.c               |  2 +-
 src/microhttpd/memorypool.c               | 35 +++++++++----
 src/microhttpd/mhd_align.h                |  2 +-
 src/microhttpd/mhd_bithelpers.h           |  2 +-
 src/microhttpd/test_str_token_remove.c    |  2 +-
 src/microhttpd/test_str_tokens_remove.c   |  2 +-
 src/microhttpd/tsearch.c                  |  2 +-
 9 files changed, 117 insertions(+), 31 deletions(-)

diff --git a/configure.ac b/configure.ac
index d06463d2..7b363d6d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -785,7 +785,7 @@ AC_INCLUDES_DEFAULT
     ])
 
   AS_IF([[test "x$HAVE_THREAD_NAME_FUNC" != "xyes" && test 
"x$ac_cv_have_decl_pthread_attr_setname_np" = "xyes"]],
-    [AC_MSG_CHECKING([[for pthread_attr_setname_np(3) in IBM i form]])
+    [AC_MSG_CHECKING([[for pthread_attr_setname_np(3) in IBM i or Solaris 
form]])
      AC_LINK_IFELSE(
       [AC_LANG_PROGRAM([[
 #include <pthread.h>
@@ -798,7 +798,7 @@ AC_INCLUDES_DEFAULT
       pthread_attr_setname_np(&thr_attr, "name");
       pthread_attr_destroy(&thr_attr);
         ]])],
-        [AC_DEFINE([[HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI]], [[1]], [Define if 
you have IBM i form of pthread_attr_setname_np(3) function.])
+        [AC_DEFINE([[HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI]], [[1]], [Define if 
you have IBM i form (or Solaris form) of pthread_attr_setname_np(3) function.])
          HAVE_THREAD_NAME_FUNC="yes"
          AC_MSG_RESULT([[yes]])],
         [AC_MSG_RESULT([[no]])]
@@ -1262,7 +1262,7 @@ MHD_CHECK_FUNC([getsockname],
     (void)getsockname(socket(0,0,0),(struct sockaddr *)&ss,(void*)0);
   ],
   [
-    AC_CACHE_CHECK([[whether getsockname() is usable]], 
[[mhc_cv_getsockname_usable]],
+    AC_CACHE_CHECK([[whether getsockname() is usable]], 
[[mhd_cv_getsockname_usable]],
       [
          AC_RUN_IFELSE(
            [
@@ -1351,17 +1351,86 @@ int main(void)
              ]]
             )
            ],
-           [[mhc_cv_getsockname_usable='yes']],
-           [[mhc_cv_getsockname_usable='no']],
-           [[mhc_cv_getsockname_usable='assuming yes']]
+           [[mhd_cv_getsockname_usable='yes']],
+           [[mhd_cv_getsockname_usable='no']],
+           [[mhd_cv_getsockname_usable='assuming yes']]
          )
         ]
       )
-    AS_VAR_IF([[mhc_cv_getsockname_usable]], [["no"]], [:],
+    AS_VAR_IF([[mhd_cv_getsockname_usable]], [["no"]], [:],
         [AC_DEFINE([[MHD_USE_GETSOCKNAME]], [[1]], [Define if you have usable 
`getsockname' function.])])
   ]
 )
 
+AC_CACHE_CHECK([for usable PAGESIZE macro], [mhd_cv_macro_pagesize_usable],
+  [
+    AC_LINK_IFELSE(
+      [
+        AC_LANG_PROGRAM(
+          [[
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifndef PAGESIZE
+#error No PAGESIZE macro defined
+choke me now
+#endif
+          ]],
+          [[
+            long pgsz = PAGESIZE + 0;
+            if (1 > pgsz) return 1;
+          ]]
+        )
+      ],
+      [[mhd_cv_macro_pagesize_usable="yes"]], 
[[mhd_cv_macro_pagesize_usable="no"]]
+    )
+  ]
+)
+AS_VAR_IF([[mhd_cv_macro_pagesize_usable]], [["yes"]],
+  [AC_DEFINE([[MHD_USE_PAGESIZE_MACRO]],[[1]],[Define if you have usable 
PAGESIZE macro])],
+  [
+    AC_CACHE_CHECK([for usable PAGE_SIZE macro], 
[mhd_cv_macro_page_size_usable],
+      [
+        AC_LINK_IFELSE(
+          [
+            AC_LANG_PROGRAM(
+              [[
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifndef PAGE_SIZE
+#error No PAGE_SIZE macro defined
+choke me now
+#endif
+              ]],
+              [[
+                long pgsz = PAGE_SIZE + 0;
+                if (1 > pgsz) return 1;
+              ]]
+            )
+          ],
+          [[mhd_cv_macro_page_size_usable="yes"]], 
[[mhd_cv_macro_page_size_usable="no"]]
+        )
+      ]
+    )
+    AS_VAR_IF([[mhd_cv_macro_page_size_usable]], [["yes"]],
+      [AC_DEFINE([[MHD_USE_PAGE_SIZE_MACRO]],[[1]],[Define if you have usable 
PAGE_SIZE macro])]
+    )
+  ]
+)
+
 # Check for inter-thread signaling type
 AC_ARG_ENABLE([[itc]],
   [AS_HELP_STRING([[--enable-itc=TYPE]], [use TYPE of inter-thread 
communication (pipe, socketpair, eventfd) [auto]])], [],
diff --git a/src/examples/websocket_threaded_example.c 
b/src/examples/websocket_threaded_example.c
index 1586933e..e2a2c9c1 100644
--- a/src/examples/websocket_threaded_example.c
+++ b/src/examples/websocket_threaded_example.c
@@ -575,14 +575,8 @@ ws_send_frame (MHD_socket sock, const char *msg, size_t 
length)
     frame[1] = length & 0x7F;
     idx_first_rdata = 2;
   }
-  else if ((length >= 126) && (length <= 0xFFFF))
-  {
-    frame[1] = 126;
-    frame[2] = (length >> 8) & 0xFF;
-    frame[3] = length & 0xFF;
-    idx_first_rdata = 4;
-  }
-  else
+#if SIZEOF_SIZE_T > 4
+  else if (0xFFFF < length)
   {
     frame[1] = 127;
     frame[2] = (unsigned char) ((length >> 56) & 0xFF);
@@ -595,6 +589,14 @@ ws_send_frame (MHD_socket sock, const char *msg, size_t 
length)
     frame[9] = (unsigned char) (length & 0xFF);
     idx_first_rdata = 10;
   }
+#endif /* SIZEOF_SIZE_T > 4 */
+  else
+  {
+    frame[1] = 126;
+    frame[2] = (length >> 8) & 0xFF;
+    frame[3] = length & 0xFF;
+    idx_first_rdata = 4;
+  }
   idx_response = 0;
   response = malloc (idx_first_rdata + length + 1);
   if (NULL == response)
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index d524954a..9f550221 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -150,7 +150,7 @@
 #endif
 
 /**
- * Response text used when the request HTTP version is too old.
+ * Response text used when the request HTTP version is not supported.
  */
 #ifdef HAVE_MESSAGES
 #define REQ_HTTP_VER_IS_NOT_SUPPORTED \
diff --git a/src/microhttpd/memorypool.c b/src/microhttpd/memorypool.c
index ffcaab43..cf0b897e 100644
--- a/src/microhttpd/memorypool.c
+++ b/src/microhttpd/memorypool.c
@@ -45,7 +45,30 @@
 #define MHD_SC_PAGESIZE _SC_PAGESIZE
 #endif /* _SC_PAGESIZE */
 #endif /* HAVE_SYSCONF */
-#include "mhd_limits.h" /* for SIZE_MAX */
+#include "mhd_limits.h" /* for SIZE_MAX, PAGESIZE / PAGE_SIZE */
+
+#if defined(MHD_USE_PAGESIZE_MACRO) || defined (MHD_USE_PAGE_SIZE_MACRO)
+#ifndef HAVE_SYSCONF /* Avoid duplicate include */
+#include <unistd.h>
+#endif /* HAVE_SYSCONF */
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif /* HAVE_SYS_PARAM_H */
+#endif /* MHD_USE_PAGESIZE_MACRO || MHD_USE_PAGE_SIZE_MACRO */
+
+/**
+ * Fallback value of page size
+ */
+#define _MHD_FALLBACK_PAGE_SIZE (4096)
+
+#if defined(MHD_USE_PAGESIZE_MACRO)
+#define MHD_DEF_PAGE_SIZE_ PAGESIZE
+#elif defined(MHD_USE_PAGE_SIZE_MACRO)
+#define MHD_DEF_PAGE_SIZE_ PAGE_SIZE
+#else  /* ! PAGESIZE */
+#define MHD_DEF_PAGE_SIZE_ _MHD_FALLBACK_PAGE_SIZE
+#endif /* ! PAGESIZE */
+
 
 #ifdef MHD_ASAN_POISON_ACTIVE
 #include <sanitizer/asan_interface.h>
@@ -94,18 +117,10 @@
   ASAN_UNPOISON_MEMORY_REGION ((pointer), (size))
 #endif /* MHD_ASAN_POISON_ACTIVE */
 
-#if defined(PAGE_SIZE) && (0 < (PAGE_SIZE + 0))
-#define MHD_DEF_PAGE_SIZE_ PAGE_SIZE
-#elif defined(PAGESIZE) && (0 < (PAGESIZE + 0))
-#define MHD_DEF_PAGE_SIZE_ PAGESIZE
-#else  /* ! PAGESIZE */
-#define MHD_DEF_PAGE_SIZE_ (4096)
-#endif /* ! PAGESIZE */
-
 /**
  * Size of memory page
  */
-static size_t MHD_sys_page_size_ = MHD_DEF_PAGE_SIZE_; /* Default fallback 
value */
+static size_t MHD_sys_page_size_ = _MHD_FALLBACK_PAGE_SIZE; /* Default 
fallback value */
 
 /**
  * Initialise values for memory pools
diff --git a/src/microhttpd/mhd_align.h b/src/microhttpd/mhd_align.h
index 4169236f..47e9f199 100644
--- a/src/microhttpd/mhd_align.h
+++ b/src/microhttpd/mhd_align.h
@@ -26,8 +26,8 @@
 #ifndef MHD_ALIGN_H
 #define MHD_ALIGN_H 1
 
-#include <stdint.h>
 #include "mhd_options.h"
+#include <stdint.h>
 #ifdef HAVE_STDDEF_H
 #include <stddef.h>
 #endif
diff --git a/src/microhttpd/mhd_bithelpers.h b/src/microhttpd/mhd_bithelpers.h
index eace0eb9..8f7058a8 100644
--- a/src/microhttpd/mhd_bithelpers.h
+++ b/src/microhttpd/mhd_bithelpers.h
@@ -26,13 +26,13 @@
 #ifndef MHD_BITHELPERS_H
 #define MHD_BITHELPERS_H 1
 
+#include "mhd_options.h"
 #include <stdint.h>
 #if defined(_MSC_FULL_VER) && (! defined(__clang__) || (defined(__c2__) && \
   defined(__OPTIMIZE__)))
 /* Declarations for VC & Clang/C2 built-ins */
 #include <intrin.h>
 #endif /* _MSC_FULL_VER  */
-#include "mhd_options.h"
 #include "mhd_assert.h"
 #include "mhd_byteorder.h"
 #if _MHD_BYTE_ORDER == _MHD_LITTLE_ENDIAN || _MHD_BYTE_ORDER == _MHD_BIG_ENDIAN
diff --git a/src/microhttpd/test_str_token_remove.c 
b/src/microhttpd/test_str_token_remove.c
index af1e7527..8334ba97 100644
--- a/src/microhttpd/test_str_token_remove.c
+++ b/src/microhttpd/test_str_token_remove.c
@@ -23,9 +23,9 @@
  * @author Karlson2k (Evgeny Grin)
  */
 
+#include "mhd_options.h"
 #include <string.h>
 #include <stdio.h>
-#include "mhd_options.h"
 #include "mhd_str.h"
 #include "mhd_assert.h"
 
diff --git a/src/microhttpd/test_str_tokens_remove.c 
b/src/microhttpd/test_str_tokens_remove.c
index b14ed908..f5347868 100644
--- a/src/microhttpd/test_str_tokens_remove.c
+++ b/src/microhttpd/test_str_tokens_remove.c
@@ -23,9 +23,9 @@
  * @author Karlson2k (Evgeny Grin)
  */
 
+#include "mhd_options.h"
 #include <string.h>
 #include <stdio.h>
-#include "mhd_options.h"
 #include "mhd_str.h"
 #include "mhd_assert.h"
 
diff --git a/src/microhttpd/tsearch.c b/src/microhttpd/tsearch.c
index 0a65ce94..26a5c769 100644
--- a/src/microhttpd/tsearch.c
+++ b/src/microhttpd/tsearch.c
@@ -9,8 +9,8 @@
  * Totally public domain.
  */
 
-#include "tsearch.h"
 #include "mhd_options.h"
+#include "tsearch.h"
 #ifdef HAVE_STDDEF_H
 #include <stddef.h>
 #else  /* ! HAVE_STDDEF_H */

-- 
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]