[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 03/07: mhd_itc.h: cosmetics
From: |
gnunet |
Subject: |
[libmicrohttpd] 03/07: mhd_itc.h: cosmetics |
Date: |
Wed, 08 Nov 2023 18:23:05 +0100 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit cec5aed907524f47ee06ebc4f9704441df5d1023
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Wed Nov 8 10:28:19 2023 +0300
mhd_itc.h: cosmetics
---
src/microhttpd/mhd_itc.h | 93 ++++++++++++++++++++++++------------------------
1 file changed, 47 insertions(+), 46 deletions(-)
diff --git a/src/microhttpd/mhd_itc.h b/src/microhttpd/mhd_itc.h
index 780a6c53..55f82664 100644
--- a/src/microhttpd/mhd_itc.h
+++ b/src/microhttpd/mhd_itc.h
@@ -42,10 +42,11 @@
# include <stdlib.h>
# endif /* HAVE_STDLIB_H */
/* Simple implementation of MHD_PANIC, to be used outside lib */
-# define MHD_PANIC(msg) do { fprintf (stderr, \
- "Abnormal termination at %d line in
file %s: %s\n", \
- (int) __LINE__, __FILE__, msg); abort
(); \
-} while (0)
+# define MHD_PANIC(msg) \
+ do { fprintf (stderr, \
+ "Abnormal termination at %d line in file %s: %s\n", \
+ (int) __LINE__, __FILE__, msg); abort (); \
+ } while (0)
#endif /* ! MHD_PANIC */
#if defined(_MHD_ITC_EVENTFD)
@@ -71,8 +72,8 @@
* @param itc the itc to initialise
* @return non-zero if succeeded, zero otherwise
*/
-#define MHD_itc_init_(itc) (-1 != ((itc).fd = eventfd (0, EFD_CLOEXEC \
- | EFD_NONBLOCK)))
+#define MHD_itc_init_(itc) \
+ (-1 != ((itc).fd = eventfd (0, EFD_CLOEXEC | EFD_NONBLOCK)))
/**
* Get description string of last errno for itc operations.
@@ -90,9 +91,9 @@ static const uint64_t _MHD_itc_wr_data = 1;
* @param str ignored
* @return non-zero if succeeded, zero otherwise
*/
-#define MHD_itc_activate_(itc, str) \
- ((write ((itc).fd, (const void*) &_MHD_itc_wr_data, 8) > 0) || (EAGAIN == \
- errno))
+#define MHD_itc_activate_(itc, str) \
+ ((write ((itc).fd, (const void*) &_MHD_itc_wr_data, \
+ sizeof(_MHD_itc_wr_data)) > 0) || (EAGAIN == errno))
/**
* Return read FD of @a itc which can be used for poll(), select() etc.
@@ -112,9 +113,9 @@ static const uint64_t _MHD_itc_wr_data = 1;
* Clear signaled state on @a itc
* @param itc the itc to clear
*/
-#define MHD_itc_clear_(itc) \
- do { uint64_t __b; \
- (void) read ((itc).fd, &__b, sizeof(__b)); \
+#define MHD_itc_clear_(itc) \
+ do { uint64_t __b; \
+ (void) read ((itc).fd, (void*)&__b, sizeof(__b)); \
} while (0)
/**
@@ -124,7 +125,8 @@ static const uint64_t _MHD_itc_wr_data = 1;
* @param itc the itc to destroy
* @return non-zero if succeeded, zero otherwise
*/
-#define MHD_itc_destroy_(itc) ((0 == close ((itc).fd)) || (EBADF != errno))
+#define MHD_itc_destroy_(itc) \
+ ((0 == close ((itc).fd)) || (EBADF != errno))
/**
* Check whether ITC has valid value.
@@ -172,11 +174,11 @@ static const uint64_t _MHD_itc_wr_data = 1;
#ifdef HAVE_PIPE2_FUNC
# define MHD_itc_init_(itc) (! pipe2 ((itc).fd, O_CLOEXEC | O_NONBLOCK))
#else /* ! HAVE_PIPE2_FUNC */
-# define MHD_itc_init_(itc) \
- ( (! pipe ((itc).fd)) ? \
+# define MHD_itc_init_(itc) \
+ ( (! pipe ((itc).fd)) ? \
(MHD_itc_nonblocking_ ((itc)) ? \
- (! 0) : \
- (MHD_itc_destroy_ ((itc)), 0) ) \
+ (! 0) : \
+ (MHD_itc_destroy_ ((itc)), 0) ) \
: (0) )
#endif /* ! HAVE_PIPE2_FUNC */
@@ -213,19 +215,19 @@ static const uint64_t _MHD_itc_wr_data = 1;
* Clear signaled state on @a itc
* @param itc the itc to clear
*/
-#define MHD_itc_clear_(itc) do \
- { long __b; \
- while (0 < read ((itc).fd[0], &__b, sizeof(__b))) \
- {} } while (0)
+#define MHD_itc_clear_(itc) do \
+ { long __b; \
+ while (0 < read ((itc).fd[0], (void*) &__b, sizeof(__b))) \
+ {(void)0;} } while (0)
/**
* Destroy previously initialised ITC
* @param itc the itc to destroy
* @return non-zero if succeeded, zero otherwise
*/
-#define MHD_itc_destroy_(itc) \
- ( (0 == close ((itc).fd[0])) ? \
- (0 == close ((itc).fd[1])) : \
+#define MHD_itc_destroy_(itc) \
+ ( (0 == close ((itc).fd[0])) ? \
+ (0 == close ((itc).fd[1])) : \
((close ((itc).fd[1])), 0) )
/**
@@ -278,11 +280,11 @@ MHD_itc_nonblocking_ (struct MHD_itc_ itc);
#ifdef MHD_socket_pair_nblk_
# define MHD_itc_init_(itc) MHD_socket_pair_nblk_ ((itc).sk)
#else /* ! MHD_socket_pair_nblk_ */
-# define MHD_itc_init_(itc) \
- (MHD_socket_pair_ ((itc).sk) ? \
+# define MHD_itc_init_(itc) \
+ (MHD_socket_pair_ ((itc).sk) ? \
(MHD_itc_nonblocking_ ((itc)) ? \
- (! 0) : \
- (MHD_itc_destroy_ ((itc)), 0) ) \
+ (! 0) : \
+ (MHD_itc_destroy_ ((itc)), 0) ) \
: (0))
#endif /* ! MHD_socket_pair_nblk_ */
@@ -297,8 +299,8 @@ MHD_itc_nonblocking_ (struct MHD_itc_ itc);
* @param str one-symbol string, useful only for strace debug
* @return non-zero if succeeded, zero otherwise
*/
-#define MHD_itc_activate_(itc, str) \
- ((MHD_send_ ((itc).sk[1], (str), 1) > 0) || \
+#define MHD_itc_activate_(itc, str) \
+ ((MHD_send_ ((itc).sk[1], (str), 1) > 0) || \
(MHD_SCKT_ERR_IS_EAGAIN_ (MHD_socket_get_error_ ())))
/**
@@ -319,21 +321,19 @@ MHD_itc_nonblocking_ (struct MHD_itc_ itc);
* Clear signaled state on @a itc
* @param itc the itc to clear
*/
-#define MHD_itc_clear_(itc) do \
- { long __b; \
- while (0 < recv ((itc).sk[0], \
- (char*) &__b, \
- sizeof(__b), 0)) \
- {} } while (0)
+#define MHD_itc_clear_(itc) do \
+ { long __b; \
+ while (0 < recv ((itc).sk[0], (void*) &__b, sizeof(__b), 0)) \
+ {(void)0;} } while (0)
/**
* Destroy previously initialised ITC
* @param itc the itc to destroy
* @return non-zero if succeeded, zero otherwise
*/
-#define MHD_itc_destroy_(itc) \
- (MHD_socket_close_ ((itc).sk[0]) ? \
- MHD_socket_close_ ((itc).sk[1]) : \
+#define MHD_itc_destroy_(itc) \
+ (MHD_socket_close_ ((itc).sk[0]) ? \
+ MHD_socket_close_ ((itc).sk[1]) : \
((void) MHD_socket_close_ ((itc).sk[1]), 0) )
@@ -352,12 +352,13 @@ MHD_itc_nonblocking_ (struct MHD_itc_ itc);
* Set @a itc to invalid value.
* @param itc the itc to set
*/
-#define MHD_itc_set_invalid_(itc) ((itc).sk[0] = (itc).sk[1] = \
- MHD_INVALID_SOCKET)
+#define MHD_itc_set_invalid_(itc) \
+ ((itc).sk[0] = (itc).sk[1] = MHD_INVALID_SOCKET)
#ifndef MHD_socket_pair_nblk_
-# define MHD_itc_nonblocking_(pip) (MHD_socket_nonblocking_ ((pip).sk[0]) && \
- MHD_socket_nonblocking_ ((pip).sk[1]))
+# define MHD_itc_nonblocking_(pip) \
+ (MHD_socket_nonblocking_ ((pip).sk[0]) && \
+ MHD_socket_nonblocking_ ((pip).sk[1]))
#endif /* ! MHD_socket_pair_nblk_ */
#endif /* _MHD_ITC_SOCKETPAIR */
@@ -367,9 +368,9 @@ MHD_itc_nonblocking_ (struct MHD_itc_ itc);
* if error is detected.
* @param itc the itc to destroy
*/
-#define MHD_itc_destroy_chk_(itc) do { \
- if (! MHD_itc_destroy_ (itc)) \
- MHD_PANIC (_ ("Failed to destroy ITC.\n")); \
+#define MHD_itc_destroy_chk_(itc) do { \
+ if (! MHD_itc_destroy_ (itc)) \
+ MHD_PANIC (_ ("Failed to destroy ITC.\n")); \
} while (0)
/**
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] branch master updated (9bdb6835 -> 32eae456), gnunet, 2023/11/08
- [libmicrohttpd] 01/07: daemon.c: cosmetics, gnunet, 2023/11/08
- [libmicrohttpd] 04/07: Upgraded connection: added missing check, gnunet, 2023/11/08
- [libmicrohttpd] 02/07: MHD_run_from_select(): reworked workaround for missing except_fd_set, gnunet, 2023/11/08
- [libmicrohttpd] 06/07: Added ignore of MHD_OPTION_APP_FD_SETSIZE when poll() is used, gnunet, 2023/11/08
- [libmicrohttpd] 03/07: mhd_itc.h: cosmetics,
gnunet <=
- [libmicrohttpd] 05/07: Additional corrections for MHD_get_fdset2(), gnunet, 2023/11/08
- [libmicrohttpd] 07/07: Added new function MHD_run_from_select2() with FD_SETSIZE value, gnunet, 2023/11/08