Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
unix, windows: remove ngx-queue.h
Browse files Browse the repository at this point in the history
Avoids an extra #include in public headers and stops the ngx_queue_*
types and macros from leaking into user code.
  • Loading branch information
bnoordhuis committed Mar 26, 2013
1 parent 76d831e commit 0635e29
Show file tree
Hide file tree
Showing 31 changed files with 339 additions and 379 deletions.
2 changes: 0 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ The externally maintained libraries used by libuv are:

- tree.h (from FreeBSD), copyright Niels Provos. Two clause BSD license.

- ngx_queue.h (from Nginx), copyright Igor Sysoev. Two clause BSD license.

- inet_pton and inet_ntop implementations, contained in src/inet.c, are
copyright the Internet Systems Consortium, Inc., and licensed under the ISC
license.
Expand Down
3 changes: 2 additions & 1 deletion config-unix.mk
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ include/uv-private/uv-unix.h: \
include/uv-private/uv-linux.h \
include/uv-private/uv-sunos.h

src/unix/internal.h: src/unix/linux-syscalls.h
src/unix/internal.h: src/unix/linux-syscalls.h src/uv-common.h
src/uv-common.h: src/queue.h

src/.buildstamp src/unix/.buildstamp test/.buildstamp:
mkdir -p $(@D)
Expand Down
129 changes: 0 additions & 129 deletions include/uv-private/ngx-queue.h

This file was deleted.

4 changes: 2 additions & 2 deletions include/uv-private/uv-darwin.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
void* cf_loop; \
uv_mutex_t cf_mutex; \
uv_sem_t cf_sem; \
ngx_queue_t cf_signals; \
void* cf_signals[2]; \

#define UV_PLATFORM_FS_EVENT_FIELDS \
uv__io_t event_watcher; \
Expand All @@ -49,7 +49,7 @@
int cf_flags; \
void* cf_eventstream; \
uv_async_t* cf_cb; \
ngx_queue_t cf_events; \
void* cf_events[2]; \
uv_sem_t cf_sem; \
uv_mutex_t cf_mutex; \

Expand Down
2 changes: 1 addition & 1 deletion include/uv-private/uv-linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
int inotify_fd; \

#define UV_PLATFORM_FS_EVENT_FIELDS \
ngx_queue_t watchers; \
void* watchers[2]; \
int wd; \

#endif /* UV_LINUX_H */
48 changes: 23 additions & 25 deletions include/uv-private/uv-unix.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
#ifndef UV_UNIX_H
#define UV_UNIX_H

#include "ngx-queue.h"

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
Expand Down Expand Up @@ -72,8 +70,8 @@ typedef struct uv__io_s uv__io_t;

struct uv__io_s {
uv__io_cb cb;
ngx_queue_t pending_queue;
ngx_queue_t watcher_queue;
void* pending_queue[2];
void* watcher_queue[2];
unsigned int pevents; /* Pending event mask i.e. mask at next tick. */
unsigned int events; /* Current event mask. */
int fd;
Expand All @@ -94,7 +92,7 @@ struct uv__work {
void (*work)(struct uv__work *w);
void (*done)(struct uv__work *w, int status);
struct uv_loop_s* loop;
ngx_queue_t wq;
void* wq[2];
};

#ifndef UV_PLATFORM_SEM_T
Expand Down Expand Up @@ -163,20 +161,20 @@ typedef struct {
#define UV_LOOP_PRIVATE_FIELDS \
unsigned long flags; \
int backend_fd; \
ngx_queue_t pending_queue; \
ngx_queue_t watcher_queue; \
void* pending_queue[2]; \
void* watcher_queue[2]; \
uv__io_t** watchers; \
unsigned int nwatchers; \
unsigned int nfds; \
ngx_queue_t wq; \
void* wq[2]; \
uv_mutex_t wq_mutex; \
uv_async_t wq_async; \
uv_handle_t* closing_handles; \
ngx_queue_t process_handles[1]; \
ngx_queue_t prepare_handles; \
ngx_queue_t check_handles; \
ngx_queue_t idle_handles; \
ngx_queue_t async_handles; \
void* process_handles[1][2]; \
void* prepare_handles[2]; \
void* check_handles[2]; \
void* idle_handles[2]; \
void* async_handles[2]; \
struct uv__async async_watcher; \
/* RB_HEAD(uv__timers, uv_timer_s) */ \
struct uv__timers { \
Expand All @@ -197,20 +195,20 @@ typedef struct {
#define UV_PRIVATE_REQ_TYPES /* empty */

#define UV_WRITE_PRIVATE_FIELDS \
ngx_queue_t queue; \
void* queue[2]; \
int write_index; \
uv_buf_t* bufs; \
int bufcnt; \
int error; \
uv_buf_t bufsml[4]; \

#define UV_CONNECT_PRIVATE_FIELDS \
ngx_queue_t queue; \
void* queue[2]; \

#define UV_SHUTDOWN_PRIVATE_FIELDS /* empty */

#define UV_UDP_SEND_PRIVATE_FIELDS \
ngx_queue_t queue; \
void* queue[2]; \
struct sockaddr_in6 addr; \
int bufcnt; \
uv_buf_t* bufs; \
Expand All @@ -226,8 +224,8 @@ typedef struct {
uv_connect_t *connect_req; \
uv_shutdown_t *shutdown_req; \
uv__io_t io_watcher; \
ngx_queue_t write_queue; \
ngx_queue_t write_completed_queue; \
void* write_queue[2]; \
void* write_completed_queue[2]; \
uv_connection_cb connection_cb; \
int delayed_error; \
int accepted_fd; \
Expand All @@ -239,8 +237,8 @@ typedef struct {
uv_alloc_cb alloc_cb; \
uv_udp_recv_cb recv_cb; \
uv__io_t io_watcher; \
ngx_queue_t write_queue; \
ngx_queue_t write_completed_queue; \
void* write_queue[2]; \
void* write_completed_queue[2]; \

#define UV_PIPE_PRIVATE_FIELDS \
const char* pipe_fname; /* strdup'ed */
Expand All @@ -250,19 +248,19 @@ typedef struct {

#define UV_PREPARE_PRIVATE_FIELDS \
uv_prepare_cb prepare_cb; \
ngx_queue_t queue;
void* queue[2]; \

#define UV_CHECK_PRIVATE_FIELDS \
uv_check_cb check_cb; \
ngx_queue_t queue;
void* queue[2]; \

#define UV_IDLE_PRIVATE_FIELDS \
uv_idle_cb idle_cb; \
ngx_queue_t queue;
void* queue[2]; \

#define UV_ASYNC_PRIVATE_FIELDS \
uv_async_cb async_cb; \
ngx_queue_t queue; \
void* queue[2]; \
int pending; \

#define UV_TIMER_PRIVATE_FIELDS \
Expand All @@ -288,7 +286,7 @@ typedef struct {
int retcode;

#define UV_PROCESS_PRIVATE_FIELDS \
ngx_queue_t queue; \
void* queue[2]; \
int errorno; \

#define UV_FS_PRIVATE_FIELDS \
Expand Down
1 change: 0 additions & 1 deletion include/uv-private/uv-win.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ typedef intptr_t ssize_t;
#endif

#include "tree.h"
#include "ngx-queue.h"

#define MAX_PIPENAME_LEN 256

Expand Down
8 changes: 4 additions & 4 deletions include/uv.h
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ UV_EXTERN const char* uv_err_name(uv_err_t err);
/* read-only */ \
uv_req_type type; \
/* private */ \
ngx_queue_t active_queue; \
void* active_queue[2]; \
UV_REQ_PRIVATE_FIELDS \

/* Abstract base class of all requests. */
Expand Down Expand Up @@ -474,7 +474,7 @@ struct uv_shutdown_s {
uv_loop_t* loop; \
uv_handle_type type; \
/* private */ \
ngx_queue_t handle_queue; \
void* handle_queue[2]; \
UV_HANDLE_PRIVATE_FIELDS \

/* The abstract base class of all handles. */
Expand Down Expand Up @@ -1958,8 +1958,8 @@ struct uv_loop_s {
uv_err_t last_err;
/* Loop reference counting */
unsigned int active_handles;
ngx_queue_t handle_queue;
ngx_queue_t active_reqs;
void* handle_queue[2];
void* active_reqs[2];
/* Internal flag to signal loop stop */
unsigned int stop_flag;
UV_LOOP_PRIVATE_FIELDS
Expand Down
Loading

0 comments on commit 0635e29

Please # to comment.