mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-10-06 04:03:18 +03:00
Always use 'struct' for ITC.
Help to detect accidental incorrect usage.
This commit is contained in:
4 files changed
+19
-25
No files matched your search
@@ -1354,7 +1354,7 @@ struct MHD_Daemon
|
||||
/**
|
||||
* Inter-thread communication channel.
|
||||
*/
|
||||
MHD_itc_ itc;
|
||||
struct MHD_itc_ itc;
|
||||
|
||||
/**
|
||||
* Are we shutting down?
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
* @return non-zero if succeeded, zero otherwise
|
||||
*/
|
||||
int
|
||||
MHD_itc_nonblocking_ (MHD_itc_ itc)
|
||||
MHD_itc_nonblocking_ (struct MHD_itc_ itc)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
* @param itc the itc to initialise
|
||||
* @return non-zero if succeeded, zero otherwise
|
||||
*/
|
||||
#define MHD_itc_init_(itc) (-1 != ((itc) = 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.
|
||||
@@ -82,21 +82,21 @@ static const uint64_t _MHD_itc_wr_data = 1;
|
||||
* @return non-zero if succeeded, zero otherwise
|
||||
*/
|
||||
#define MHD_itc_activate_(itc, str) \
|
||||
((write((itc), (const void*)&_MHD_itc_wr_data, 8) > 0) || (EAGAIN == errno))
|
||||
((write((itc).fd, (const void*)&_MHD_itc_wr_data, 8) > 0) || (EAGAIN == errno))
|
||||
|
||||
/**
|
||||
* Return read FD of @a itc which can be used for poll(), select() etc.
|
||||
* @param itc the itc to get FD
|
||||
* @return FD of read side
|
||||
*/
|
||||
#define MHD_itc_r_fd_(itc) ((int)(itc))
|
||||
#define MHD_itc_r_fd_(itc) ((itc).fd)
|
||||
|
||||
/**
|
||||
* Return write FD of @a itc
|
||||
* @param itc the itc to get FD
|
||||
* @return FD of write side
|
||||
*/
|
||||
#define MHD_itc_w_fd_(itc) ((int)(itc))
|
||||
#define MHD_itc_w_fd_(itc) ((itc).fd)
|
||||
|
||||
/**
|
||||
* Clear signaled state on @a itc
|
||||
@@ -104,7 +104,7 @@ static const uint64_t _MHD_itc_wr_data = 1;
|
||||
*/
|
||||
#define MHD_itc_clear_(itc) \
|
||||
do { uint64_t __b; int __r; \
|
||||
__r = read((itc), &__b, sizeof(__b)); \
|
||||
__r = read((itc).fd, &__b, sizeof(__b)); \
|
||||
(void)__r; } while(0)
|
||||
|
||||
/**
|
||||
@@ -112,7 +112,7 @@ 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)) || (EBADF != errno))
|
||||
#define MHD_itc_destroy_(itc) ((0 != close ((itc).fd)) || (EBADF != errno))
|
||||
|
||||
/**
|
||||
* Check whether ITC has valid value.
|
||||
@@ -123,13 +123,13 @@ static const uint64_t _MHD_itc_wr_data = 1;
|
||||
* @return boolean true if @a itc has valid value,
|
||||
* boolean false otherwise.
|
||||
*/
|
||||
#define MHD_ITC_IS_VALID_(itc) (-1 != (itc))
|
||||
#define MHD_ITC_IS_VALID_(itc) (-1 != ((itc).fd))
|
||||
|
||||
/**
|
||||
* Set @a itc to invalid value.
|
||||
* @param itc the itc to set
|
||||
*/
|
||||
#define MHD_itc_set_invalid_(itc) ((itc) = -1)
|
||||
#define MHD_itc_set_invalid_(itc) ((itc).fd = -1)
|
||||
|
||||
|
||||
#elif defined(_MHD_ITC_PIPE)
|
||||
@@ -236,7 +236,7 @@ static const uint64_t _MHD_itc_wr_data = 1;
|
||||
* @return non-zero if succeeded, zero otherwise
|
||||
*/
|
||||
int
|
||||
MHD_itc_nonblocking_ (MHD_itc_ itc);
|
||||
MHD_itc_nonblocking_ (struct MHD_itc_ itc);
|
||||
#endif /* ! HAVE_PIPE2_FUNC */
|
||||
|
||||
|
||||
|
||||
@@ -42,23 +42,22 @@
|
||||
/**
|
||||
* Data type for a MHD ITC.
|
||||
*/
|
||||
typedef int MHD_itc_;
|
||||
struct MHD_itc_
|
||||
{
|
||||
int fd;
|
||||
};
|
||||
|
||||
#elif defined(_MHD_ITC_PIPE)
|
||||
/* **************** Standard UNIX ITC implementation by pipe ********** */
|
||||
|
||||
/**
|
||||
* Base data type for a MHD ITC.
|
||||
* Data type for a MHD ITC.
|
||||
*/
|
||||
struct MHD_Itc
|
||||
struct MHD_itc_
|
||||
{
|
||||
int fd[2];
|
||||
};
|
||||
|
||||
/**
|
||||
* Data type for a MHD ITC.
|
||||
*/
|
||||
typedef struct MHD_Itc MHD_itc_;
|
||||
|
||||
#elif defined(_MHD_ITC_SOCKETPAIR)
|
||||
/* **************** ITC implementation by socket pair ********** */
|
||||
@@ -66,18 +65,13 @@ typedef struct MHD_Itc MHD_itc_;
|
||||
#include "mhd_sockets.h"
|
||||
|
||||
/**
|
||||
* Base data type for a MHD ITC.
|
||||
* Data type for a MHD ITC.
|
||||
*/
|
||||
struct MHD_Itc
|
||||
struct MHD_itc_
|
||||
{
|
||||
MHD_socket sk[2];
|
||||
};
|
||||
|
||||
/**
|
||||
* Data type for a MHD ITC.
|
||||
*/
|
||||
typedef struct MHD_Itc MHD_itc_;
|
||||
|
||||
#endif /* _MHD_ITC_SOCKETPAIR */
|
||||
|
||||
#endif /* ! MHD_ITC_TYPES_H */
|
||||
Reference in new issue
Block a user