src: rename/remove macros that clang says have reserved names
This commit is contained in:
parent
8f4d4e9602
commit
613a821a30
@ -8,7 +8,6 @@
|
|||||||
#include "win.h"
|
#include "win.h"
|
||||||
#include "ws.h"
|
#include "ws.h"
|
||||||
|
|
||||||
#define _AFD_ANY_PROTOCOL -1
|
|
||||||
#define IOCTL_AFD_POLL 0x00012024
|
#define IOCTL_AFD_POLL 0x00012024
|
||||||
|
|
||||||
/* clang-format off */
|
/* clang-format off */
|
||||||
@ -27,6 +26,8 @@ static const GUID _AFD_PROVIDER_GUID_LIST[] = {
|
|||||||
{0xb6, 0x55, 0x00, 0x80, 0x5f, 0x36, 0x42, 0xcc}}};
|
{0xb6, 0x55, 0x00, 0x80, 0x5f, 0x36, 0x42, 0xcc}}};
|
||||||
/* clang-format on */
|
/* clang-format on */
|
||||||
|
|
||||||
|
static const int _AFD_ANY_PROTOCOL = -1;
|
||||||
|
|
||||||
/* This protocol info record is used by afd_create_driver_socket() to create
|
/* This protocol info record is used by afd_create_driver_socket() to create
|
||||||
* sockets that can be used as the first argument to afd_poll(). It is
|
* sockets that can be used as the first argument to afd_poll(). It is
|
||||||
* populated on startup by afd_global_init(). */
|
* populated on startup by afd_global_init(). */
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
|
|
||||||
#define _ERROR_ERRNO_MAP(X) \
|
#define ERR__ERRNO_MAPPINGS(X) \
|
||||||
X(ERROR_ACCESS_DENIED, EACCES) \
|
X(ERROR_ACCESS_DENIED, EACCES) \
|
||||||
X(ERROR_ALREADY_EXISTS, EEXIST) \
|
X(ERROR_ALREADY_EXISTS, EEXIST) \
|
||||||
X(ERROR_BAD_COMMAND, EACCES) \
|
X(ERROR_BAD_COMMAND, EACCES) \
|
||||||
@ -111,7 +111,7 @@ static errno_t _err_map_win_error_to_errno(DWORD error) {
|
|||||||
#define X(error_sym, errno_sym) \
|
#define X(error_sym, errno_sym) \
|
||||||
case error_sym: \
|
case error_sym: \
|
||||||
return errno_sym;
|
return errno_sym;
|
||||||
_ERROR_ERRNO_MAP(X)
|
ERR__ERRNO_MAPPINGS(X)
|
||||||
#undef X
|
#undef X
|
||||||
}
|
}
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
#include "wepoll.h"
|
#include "wepoll.h"
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
|
|
||||||
#define _PORT_MAX_ON_STACK_COMPLETIONS 256
|
#define EP_PORT__MAX_ON_STACK_COMPLETIONS 256
|
||||||
|
|
||||||
static ep_port_t* _ep_port_alloc(void) {
|
static ep_port_t* _ep_port_alloc(void) {
|
||||||
ep_port_t* port_info = malloc(sizeof *port_info);
|
ep_port_t* port_info = malloc(sizeof *port_info);
|
||||||
@ -195,7 +195,7 @@ int ep_port_wait(ep_port_t* port_info,
|
|||||||
struct epoll_event* events,
|
struct epoll_event* events,
|
||||||
int maxevents,
|
int maxevents,
|
||||||
int timeout) {
|
int timeout) {
|
||||||
OVERLAPPED_ENTRY stack_iocp_events[_PORT_MAX_ON_STACK_COMPLETIONS];
|
OVERLAPPED_ENTRY stack_iocp_events[EP_PORT__MAX_ON_STACK_COMPLETIONS];
|
||||||
OVERLAPPED_ENTRY* iocp_events;
|
OVERLAPPED_ENTRY* iocp_events;
|
||||||
uint64_t due = 0;
|
uint64_t due = 0;
|
||||||
DWORD gqcs_timeout;
|
DWORD gqcs_timeout;
|
||||||
|
|||||||
10
src/sock.c
10
src/sock.c
@ -11,9 +11,9 @@
|
|||||||
#include "sock.h"
|
#include "sock.h"
|
||||||
#include "ws.h"
|
#include "ws.h"
|
||||||
|
|
||||||
#define _KNOWN_EPOLL_EVENTS \
|
static const uint32_t _EP_SOCK_KNOWN_EPOLL_EVENTS =
|
||||||
(EPOLLIN | EPOLLPRI | EPOLLOUT | EPOLLERR | EPOLLHUP | EPOLLRDNORM | \
|
EPOLLIN | EPOLLPRI | EPOLLOUT | EPOLLERR | EPOLLHUP | EPOLLRDNORM |
|
||||||
EPOLLRDBAND | EPOLLWRNORM | EPOLLWRBAND | EPOLLRDHUP)
|
EPOLLRDBAND | EPOLLWRNORM | EPOLLWRBAND | EPOLLMSG | EPOLLRDHUP;
|
||||||
|
|
||||||
typedef enum _poll_status {
|
typedef enum _poll_status {
|
||||||
_POLL_IDLE = 0,
|
_POLL_IDLE = 0,
|
||||||
@ -151,7 +151,7 @@ int ep_sock_set_event(ep_port_t* port_info,
|
|||||||
sock_info->user_events = events;
|
sock_info->user_events = events;
|
||||||
sock_info->user_data = ev->data;
|
sock_info->user_data = ev->data;
|
||||||
|
|
||||||
if ((events & _KNOWN_EPOLL_EVENTS & ~sock_info->pending_events) != 0)
|
if ((events & _EP_SOCK_KNOWN_EPOLL_EVENTS & ~sock_info->pending_events) != 0)
|
||||||
ep_port_request_socket_update(port_info, sock_info);
|
ep_port_request_socket_update(port_info, sock_info);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -201,7 +201,7 @@ int ep_sock_update(ep_port_t* port_info, ep_sock_t* sock_info) {
|
|||||||
assert(!sock_info->delete_pending);
|
assert(!sock_info->delete_pending);
|
||||||
|
|
||||||
if ((sock_info->poll_status == _POLL_PENDING) &&
|
if ((sock_info->poll_status == _POLL_PENDING) &&
|
||||||
(sock_info->user_events & _KNOWN_EPOLL_EVENTS &
|
(sock_info->user_events & _EP_SOCK_KNOWN_EPOLL_EVENTS &
|
||||||
~sock_info->pending_events) == 0) {
|
~sock_info->pending_events) == 0) {
|
||||||
/* All the events the user is interested in are already being monitored by
|
/* All the events the user is interested in are already being monitored by
|
||||||
* the pending poll operation. It might spuriously complete because of an
|
* the pending poll operation. It might spuriously complete because of an
|
||||||
|
|||||||
24
src/tree.c
24
src/tree.c
@ -13,7 +13,7 @@ void tree_node_init(tree_node_t* node) {
|
|||||||
memset(node, 0, sizeof *node);
|
memset(node, 0, sizeof *node);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define _TREE_ROTATE(cis, trans) \
|
#define TREE__ROTATE(cis, trans) \
|
||||||
tree_node_t* p = node; \
|
tree_node_t* p = node; \
|
||||||
tree_node_t* q = node->trans; \
|
tree_node_t* q = node->trans; \
|
||||||
tree_node_t* parent = p->parent; \
|
tree_node_t* parent = p->parent; \
|
||||||
@ -35,14 +35,14 @@ void tree_node_init(tree_node_t* node) {
|
|||||||
q->cis = p;
|
q->cis = p;
|
||||||
|
|
||||||
static inline void _tree_rotate_left(tree_t* tree, tree_node_t* node) {
|
static inline void _tree_rotate_left(tree_t* tree, tree_node_t* node) {
|
||||||
_TREE_ROTATE(left, right)
|
TREE__ROTATE(left, right)
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void _tree_rotate_right(tree_t* tree, tree_node_t* node) {
|
static inline void _tree_rotate_right(tree_t* tree, tree_node_t* node) {
|
||||||
_TREE_ROTATE(right, left)
|
TREE__ROTATE(right, left)
|
||||||
}
|
}
|
||||||
|
|
||||||
#define _TREE_INSERT_OR_DESCEND(side) \
|
#define TREE__INSERT_OR_DESCEND(side) \
|
||||||
if (parent->side) { \
|
if (parent->side) { \
|
||||||
parent = parent->side; \
|
parent = parent->side; \
|
||||||
} else { \
|
} else { \
|
||||||
@ -50,7 +50,7 @@ static inline void _tree_rotate_right(tree_t* tree, tree_node_t* node) {
|
|||||||
break; \
|
break; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define _TREE_FIXUP_AFTER_INSERT(cis, trans) \
|
#define TREE__FIXUP_AFTER_INSERT(cis, trans) \
|
||||||
tree_node_t* grandparent = parent->parent; \
|
tree_node_t* grandparent = parent->parent; \
|
||||||
tree_node_t* uncle = grandparent->trans; \
|
tree_node_t* uncle = grandparent->trans; \
|
||||||
\
|
\
|
||||||
@ -76,9 +76,9 @@ int tree_add(tree_t* tree, tree_node_t* node, uintptr_t key) {
|
|||||||
if (parent) {
|
if (parent) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (key < parent->key) {
|
if (key < parent->key) {
|
||||||
_TREE_INSERT_OR_DESCEND(left)
|
TREE__INSERT_OR_DESCEND(left)
|
||||||
} else if (key > parent->key) {
|
} else if (key > parent->key) {
|
||||||
_TREE_INSERT_OR_DESCEND(right)
|
TREE__INSERT_OR_DESCEND(right)
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -94,9 +94,9 @@ int tree_add(tree_t* tree, tree_node_t* node, uintptr_t key) {
|
|||||||
|
|
||||||
for (; parent && parent->red; parent = node->parent) {
|
for (; parent && parent->red; parent = node->parent) {
|
||||||
if (parent == parent->parent->left) {
|
if (parent == parent->parent->left) {
|
||||||
_TREE_FIXUP_AFTER_INSERT(left, right)
|
TREE__FIXUP_AFTER_INSERT(left, right)
|
||||||
} else {
|
} else {
|
||||||
_TREE_FIXUP_AFTER_INSERT(right, left)
|
TREE__FIXUP_AFTER_INSERT(right, left)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tree->root->red = false;
|
tree->root->red = false;
|
||||||
@ -104,7 +104,7 @@ int tree_add(tree_t* tree, tree_node_t* node, uintptr_t key) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define _TREE_FIXUP_AFTER_REMOVE(cis, trans) \
|
#define TREE__FIXUP_AFTER_REMOVE(cis, trans) \
|
||||||
tree_node_t* sibling = parent->trans; \
|
tree_node_t* sibling = parent->trans; \
|
||||||
\
|
\
|
||||||
if (sibling->red) { \
|
if (sibling->red) { \
|
||||||
@ -190,9 +190,9 @@ void tree_del(tree_t* tree, tree_node_t* node) {
|
|||||||
if (node == tree->root)
|
if (node == tree->root)
|
||||||
break;
|
break;
|
||||||
if (node == parent->left) {
|
if (node == parent->left) {
|
||||||
_TREE_FIXUP_AFTER_REMOVE(left, right)
|
TREE__FIXUP_AFTER_REMOVE(left, right)
|
||||||
} else {
|
} else {
|
||||||
_TREE_FIXUP_AFTER_REMOVE(right, left)
|
TREE__FIXUP_AFTER_REMOVE(right, left)
|
||||||
}
|
}
|
||||||
node = parent;
|
node = parent;
|
||||||
parent = parent->parent;
|
parent = parent->parent;
|
||||||
|
|||||||
4
src/ws.c
4
src/ws.c
@ -10,7 +10,7 @@
|
|||||||
#define SIO_BASE_HANDLE 0x48000022
|
#define SIO_BASE_HANDLE 0x48000022
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define _WS_INITIAL_CATALOG_BUFFER_SIZE 0x4000 /* 16kb. */
|
#define WS__INITIAL_CATALOG_BUFFER_SIZE 0x4000 /* 16kb. */
|
||||||
|
|
||||||
int ws_global_init(void) {
|
int ws_global_init(void) {
|
||||||
int r;
|
int r;
|
||||||
@ -45,7 +45,7 @@ SOCKET ws_get_base_socket(SOCKET socket) {
|
|||||||
* The infos pointer must be released by the caller with free(). */
|
* The infos pointer must be released by the caller with free(). */
|
||||||
int ws_get_protocol_catalog(WSAPROTOCOL_INFOW** infos_out,
|
int ws_get_protocol_catalog(WSAPROTOCOL_INFOW** infos_out,
|
||||||
size_t* infos_count_out) {
|
size_t* infos_count_out) {
|
||||||
DWORD buffer_size = _WS_INITIAL_CATALOG_BUFFER_SIZE;
|
DWORD buffer_size = WS__INITIAL_CATALOG_BUFFER_SIZE;
|
||||||
int count;
|
int count;
|
||||||
WSAPROTOCOL_INFOW* infos;
|
WSAPROTOCOL_INFOW* infos;
|
||||||
|
|
||||||
|
|||||||
@ -21,16 +21,16 @@
|
|||||||
|
|
||||||
void no_inline no_return check_fail(const char* message);
|
void no_inline no_return check_fail(const char* message);
|
||||||
|
|
||||||
#define __check_to_string_helper(v) #v
|
#define _check_to_string_helper(v) #v
|
||||||
#define __check_to_string(v) __check_to_string_helper(v)
|
#define _check_to_string(v) _check_to_string_helper(v)
|
||||||
|
|
||||||
#define check(expression) \
|
#define check(expression) \
|
||||||
(void) ((!!(expression)) || \
|
(void) ((!!(expression)) || \
|
||||||
(check_fail("\n" \
|
(check_fail("\n" \
|
||||||
"Check failed:\n" \
|
"Check failed:\n" \
|
||||||
" test: " #expression "\n" \
|
" test: " #expression "\n" \
|
||||||
" file: " __FILE__ "\n" \
|
" file: " __FILE__ "\n" \
|
||||||
" line: " __check_to_string(__LINE__) "\n"), \
|
" line: " _check_to_string(__LINE__) "\n"), \
|
||||||
0))
|
0))
|
||||||
|
|
||||||
#endif /* TEST_UTIL_H_ */
|
#endif /* TEST_UTIL_H_ */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user