mirror of
https://github.com/curl/curl.git
synced 2026-08-25 00:33:31 +03:00
lib: fix formatting nits (part 3)
From `lib/h` to `lib/w`. part 1:47a1ab2ebe#19764 part 2:86b346443b#19800 Closes #19811
This commit is contained in:
parent
dc8c0d54a5
commit
c3b030b860
102 changed files with 2001 additions and 2226 deletions
61
lib/select.h
61
lib/select.h
|
|
@ -47,11 +47,10 @@
|
|||
#define POLLHUP 0x10
|
||||
#define POLLNVAL 0x20
|
||||
|
||||
struct pollfd
|
||||
{
|
||||
curl_socket_t fd;
|
||||
short events;
|
||||
short revents;
|
||||
struct pollfd {
|
||||
curl_socket_t fd;
|
||||
short events;
|
||||
short revents;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -76,9 +75,9 @@ struct pollfd
|
|||
int Curl_socket_check(curl_socket_t readfd, curl_socket_t readfd2,
|
||||
curl_socket_t writefd,
|
||||
timediff_t timeout_ms);
|
||||
#define SOCKET_READABLE(x,z) \
|
||||
#define SOCKET_READABLE(x, z) \
|
||||
Curl_socket_check(x, CURL_SOCKET_BAD, CURL_SOCKET_BAD, z)
|
||||
#define SOCKET_WRITABLE(x,z) \
|
||||
#define SOCKET_WRITABLE(x, z) \
|
||||
Curl_socket_check(CURL_SOCKET_BAD, CURL_SOCKET_BAD, x, z)
|
||||
|
||||
int Curl_poll(struct pollfd ufds[], unsigned int nfds, timediff_t timeout_ms);
|
||||
|
|
@ -90,32 +89,33 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, timediff_t timeout_ms);
|
|||
#ifdef USE_WINSOCK
|
||||
#define VALID_SOCK(s) ((s) < INVALID_SOCKET)
|
||||
#define FDSET_SOCK(x) 1
|
||||
#define VERIFY_SOCK(x) do { \
|
||||
if(!VALID_SOCK(x)) { \
|
||||
SET_SOCKERRNO(SOCKEINVAL); \
|
||||
return -1; \
|
||||
} \
|
||||
} while(0)
|
||||
#define VERIFY_SOCK(x) \
|
||||
do { \
|
||||
if(!VALID_SOCK(x)) { \
|
||||
SET_SOCKERRNO(SOCKEINVAL); \
|
||||
return -1; \
|
||||
} \
|
||||
} while(0)
|
||||
#else
|
||||
#define VALID_SOCK(s) ((s) >= 0)
|
||||
|
||||
/* If the socket is small enough to get set or read from an fdset */
|
||||
#define FDSET_SOCK(s) ((s) < FD_SETSIZE)
|
||||
|
||||
#define VERIFY_SOCK(x) do { \
|
||||
if(!VALID_SOCK(x) || !FDSET_SOCK(x)) { \
|
||||
SET_SOCKERRNO(SOCKEINVAL); \
|
||||
return -1; \
|
||||
} \
|
||||
#define VERIFY_SOCK(x) \
|
||||
do { \
|
||||
if(!VALID_SOCK(x) || !FDSET_SOCK(x)) { \
|
||||
SET_SOCKERRNO(SOCKEINVAL); \
|
||||
return -1; \
|
||||
} \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
|
||||
/* Keep the sockets to poll for an easy handle.
|
||||
* `actions` are bitmaps of CURL_POLL_IN and CURL_POLL_OUT.
|
||||
* Starts with small capacity, grows on demand.
|
||||
*/
|
||||
#define EZ_POLLSET_DEF_COUNT 2
|
||||
#define EZ_POLLSET_DEF_COUNT 2
|
||||
|
||||
struct easy_pollset {
|
||||
curl_socket_t *sockets;
|
||||
|
|
@ -133,7 +133,6 @@ struct easy_pollset {
|
|||
#define CURL_EASY_POLLSET_MAGIC 0x7a657370
|
||||
#endif
|
||||
|
||||
|
||||
/* allocate and initialise */
|
||||
struct easy_pollset *Curl_pollset_create(void);
|
||||
|
||||
|
|
@ -162,22 +161,22 @@ CURLcode Curl_pollset_set(struct Curl_easy *data,
|
|||
bool do_in, bool do_out) WARN_UNUSED_RESULT;
|
||||
|
||||
#define Curl_pollset_add_in(data, ps, sock) \
|
||||
Curl_pollset_change((data), (ps), (sock), CURL_POLL_IN, 0)
|
||||
Curl_pollset_change((data), (ps), (sock), CURL_POLL_IN, 0)
|
||||
#define Curl_pollset_remove_in(data, ps, sock) \
|
||||
Curl_pollset_change((data), (ps), (sock), 0, CURL_POLL_IN)
|
||||
Curl_pollset_change((data), (ps), (sock), 0, CURL_POLL_IN)
|
||||
#define Curl_pollset_add_out(data, ps, sock) \
|
||||
Curl_pollset_change((data), (ps), (sock), CURL_POLL_OUT, 0)
|
||||
Curl_pollset_change((data), (ps), (sock), CURL_POLL_OUT, 0)
|
||||
#define Curl_pollset_remove_out(data, ps, sock) \
|
||||
Curl_pollset_change((data), (ps), (sock), 0, CURL_POLL_OUT)
|
||||
Curl_pollset_change((data), (ps), (sock), 0, CURL_POLL_OUT)
|
||||
#define Curl_pollset_add_inout(data, ps, sock) \
|
||||
Curl_pollset_change((data), (ps), (sock), \
|
||||
CURL_POLL_IN|CURL_POLL_OUT, 0)
|
||||
Curl_pollset_change((data), (ps), (sock), \
|
||||
CURL_POLL_IN | CURL_POLL_OUT, 0)
|
||||
#define Curl_pollset_set_in_only(data, ps, sock) \
|
||||
Curl_pollset_change((data), (ps), (sock), \
|
||||
CURL_POLL_IN, CURL_POLL_OUT)
|
||||
Curl_pollset_change((data), (ps), (sock), \
|
||||
CURL_POLL_IN, CURL_POLL_OUT)
|
||||
#define Curl_pollset_set_out_only(data, ps, sock) \
|
||||
Curl_pollset_change((data), (ps), (sock), \
|
||||
CURL_POLL_OUT, CURL_POLL_IN)
|
||||
Curl_pollset_change((data), (ps), (sock), \
|
||||
CURL_POLL_OUT, CURL_POLL_IN)
|
||||
|
||||
/* return < = on error, 0 on timeout or how many sockets are ready */
|
||||
int Curl_pollset_poll(struct Curl_easy *data,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue