Skip to content

Commit

Permalink
Stop g++ from complaining about anonymous struct usage
Browse files Browse the repository at this point in the history
  • Loading branch information
piscisaureus committed Jul 15, 2011
1 parent d56af31 commit c1bddb9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
6 changes: 4 additions & 2 deletions include/uv-unix.h
Expand Up @@ -55,6 +55,8 @@ typedef struct {
#define UV_CONNECT_PRIVATE_FIELDS \
ngx_queue_t queue;

#define UV_PRIVATE_REQ_TYPES /* empty */


/* TODO: union or classes please! */
#define UV_HANDLE_PRIVATE_FIELDS \
Expand All @@ -79,8 +81,8 @@ typedef struct {
ev_io write_watcher; \
ngx_queue_t write_queue; \
ngx_queue_t write_completed_queue;


/* UV_NAMED_PIPE */
#define UV_PIPE_PRIVATE_TYPEDEF
#define UV_PIPE_PRIVATE_FIELDS
Expand Down
15 changes: 9 additions & 6 deletions include/uv-win.h
Expand Up @@ -62,6 +62,13 @@ typedef struct uv_buf_t {
#define UV_SHUTDOWN_PRIVATE_FIELDS \
/* empty */

#define UV_PRIVATE_REQ_TYPES \
typedef struct uv_pipe_accept_s { \
UV_REQ_FIELDS \
HANDLE pipeHandle; \
struct uv_pipe_accept_s* next_pending; \
} uv_pipe_accept_t;

#define uv_stream_connection_fields \
unsigned int write_reqs_pending; \
uv_shutdown_t* shutdown_req;
Expand Down Expand Up @@ -90,12 +97,8 @@ typedef struct uv_buf_t {

#define uv_pipe_server_fields \
char* name; \
struct uv_pipe_accept_s { \
UV_REQ_FIELDS \
HANDLE pipeHandle; \
struct uv_pipe_accept_s* next_pending; \
} accept_reqs[4]; \
struct uv_pipe_accept_s* pending_accepts;
uv_pipe_accept_t accept_reqs[4]; \
uv_pipe_accept_t* pending_accepts;

#define uv_pipe_connection_fields \
HANDLE handle;
Expand Down
4 changes: 4 additions & 0 deletions include/uv.h
Expand Up @@ -185,6 +185,10 @@ struct uv_req_s {
};


/* Platform-specific request types */
UV_PRIVATE_REQ_TYPES


/*
* Shutdown the outgoing (write) side of a duplex stream. It waits for
* pending write requests to complete. The handle should refer to a
Expand Down
8 changes: 4 additions & 4 deletions src/uv-win.c
Expand Up @@ -993,7 +993,7 @@ static void uv_tcp_queue_accept(uv_tcp_t* handle) {
}


static void uv_pipe_queue_accept(uv_pipe_t* handle, struct uv_pipe_accept_s* req) {
static void uv_pipe_queue_accept(uv_pipe_t* handle, uv_pipe_accept_t* req) {
HANDLE pipeHandle;

assert(handle->flags & UV_HANDLE_LISTENING);
Expand Down Expand Up @@ -1173,7 +1173,7 @@ static int uv_tcp_accept(uv_tcp_t* server, uv_tcp_t* client) {

static int uv_pipe_accept(uv_pipe_t* server, uv_pipe_t* client) {
/* Find a connection instance that has been connected, but not yet accepted. */
struct uv_pipe_accept_s* req = server->pending_accepts;
uv_pipe_accept_t* req = server->pending_accepts;

if (!req) {
/* No valid connections found, so we error out. */
Expand Down Expand Up @@ -1847,7 +1847,7 @@ static void uv_process_pipe_write_req(uv_pipe_t* handle, uv_write_t* req) {


static void uv_process_pipe_accept_req(uv_pipe_t* handle, uv_req_t* raw_req) {
struct uv_pipe_accept_s* req = (struct uv_pipe_accept_s*) raw_req;
uv_pipe_accept_t* req = (uv_pipe_accept_t*) raw_req;

assert(handle->type == UV_NAMED_PIPE);

Expand Down Expand Up @@ -2981,7 +2981,7 @@ int uv_pipe_init(uv_pipe_t* handle) {
/* TODO: make this work with UTF8 name */
int uv_pipe_bind(uv_pipe_t* handle, const char* name) {
int i;
struct uv_pipe_accept_s* req;
uv_pipe_accept_t* req;

if (!name) {
uv_set_sys_error(WSAEINVAL);
Expand Down

0 comments on commit c1bddb9

Please sign in to comment.