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 handle init counters
Browse files Browse the repository at this point in the history
Remove the handle init counters, no one uses them.
  • Loading branch information
bnoordhuis committed Aug 10, 2012
1 parent caa79af commit 837edf4
Show file tree
Hide file tree
Showing 35 changed files with 0 additions and 282 deletions.
2 changes: 0 additions & 2 deletions include/uv.h
Expand Up @@ -1802,8 +1802,6 @@ struct uv_counters_s {

struct uv_loop_s {
UV_LOOP_PRIVATE_FIELDS
/* Diagnostic counters */
uv_counters_t counters;
/* The last error */
uv_err_t last_err;
/* Loop reference counting */
Expand Down
2 changes: 0 additions & 2 deletions src/fs-poll.c
Expand Up @@ -36,8 +36,6 @@ static uv_statbuf_t zero_statbuf;
int uv_fs_poll_init(uv_loop_t* loop, uv_fs_poll_t* handle) {
/* TODO(bnoordhuis) Mark fs_req internal. */
uv__handle_init(loop, (uv_handle_t*)handle, UV_FS_POLL);
loop->counters.fs_poll_init++;

if (uv_timer_init(loop, &handle->timer_handle))
return -1;

Expand Down
2 changes: 0 additions & 2 deletions src/unix/async.c
Expand Up @@ -65,8 +65,6 @@ int uv_async_init(uv_loop_t* loop, uv_async_t* handle, uv_async_cb async_cb) {
return uv__set_sys_error(loop, errno);

uv__handle_init(loop, (uv_handle_t*)handle, UV_ASYNC);
loop->counters.async_init++;

handle->async_cb = async_cb;
handle->pending = 0;

Expand Down
1 change: 0 additions & 1 deletion src/unix/cygwin.c
Expand Up @@ -73,7 +73,6 @@ int uv_fs_event_init(uv_loop_t* loop,
const char* filename,
uv_fs_event_cb cb,
int flags) {
loop->counters.fs_event_init++;
uv__set_sys_error(loop, ENOSYS);
return -1;
}
Expand Down
1 change: 0 additions & 1 deletion src/unix/internal.h
Expand Up @@ -105,7 +105,6 @@ enum {
inline static void uv__req_init(uv_loop_t* loop,
uv_req_t* req,
uv_req_type type) {
loop->counters.req_init++;
req->type = type;
uv__req_register(loop, req);
}
Expand Down
2 changes: 0 additions & 2 deletions src/unix/kqueue.c
Expand Up @@ -90,8 +90,6 @@ int uv_fs_event_init(uv_loop_t* loop,
int flags) {
int fd;

loop->counters.fs_event_init++;

/* We don't support any flags yet. */
assert(!flags);

Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux/inotify.c
Expand Up @@ -176,8 +176,6 @@ int uv_fs_event_init(uv_loop_t* loop,
int events;
int wd;

loop->counters.fs_event_init++;

/* We don't support any flags yet. */
assert(!flags);

Expand Down
1 change: 0 additions & 1 deletion src/unix/loop-watcher.c
Expand Up @@ -25,7 +25,6 @@
#define UV_LOOP_WATCHER_DEFINE(name, type) \
int uv_##name##_init(uv_loop_t* loop, uv_##name##_t* handle) { \
uv__handle_init(loop, (uv_handle_t*)handle, UV_##type); \
loop->counters.name##_init++; \
handle->name##_cb = NULL; \
return 0; \
} \
Expand Down
1 change: 0 additions & 1 deletion src/unix/pipe.c
Expand Up @@ -34,7 +34,6 @@ static void uv__pipe_accept(uv_loop_t* loop, uv__io_t* w, int events);

int uv_pipe_init(uv_loop_t* loop, uv_pipe_t* handle, int ipc) {
uv__stream_init(loop, (uv_stream_t*)handle, UV_NAMED_PIPE);
loop->counters.pipe_init++;
handle->shutdown_req = NULL;
handle->connect_req = NULL;
handle->pipe_fname = NULL;
Expand Down
2 changes: 0 additions & 2 deletions src/unix/poll.c
Expand Up @@ -54,8 +54,6 @@ static void uv__poll_io(uv_loop_t* loop, uv__io_t* w, int events) {

int uv_poll_init(uv_loop_t* loop, uv_poll_t* handle, int fd) {
uv__handle_init(loop, (uv_handle_t*) handle, UV_POLL);
loop->counters.poll_init++;

handle->fd = fd;
handle->poll_cb = NULL;
uv__io_init(&handle->io_watcher, uv__poll_io, fd, 0);
Expand Down
1 change: 0 additions & 1 deletion src/unix/process.c
Expand Up @@ -362,7 +362,6 @@ int uv_spawn(uv_loop_t* loop,
UV_PROCESS_SETUID)));

uv__handle_init(loop, (uv_handle_t*)process, UV_PROCESS);
loop->counters.process_init++;
ngx_queue_init(&process->queue);

stdio_count = options.stdio_count;
Expand Down
3 changes: 0 additions & 3 deletions src/unix/stream.c
Expand Up @@ -57,8 +57,6 @@ void uv__stream_init(uv_loop_t* loop,
uv_stream_t* stream,
uv_handle_type type) {
uv__handle_init(loop, (uv_handle_t*)stream, type);
loop->counters.stream_init++;

stream->alloc_cb = NULL;
stream->close_cb = NULL;
stream->connection_cb = NULL;
Expand Down Expand Up @@ -489,7 +487,6 @@ static void uv__write(uv_stream_t* stream) {
} else {
/* Successful write */

/* Update the counters. */
while (n >= 0) {
uv_buf_t* buf = &(req->bufs[req->write_index]);
size_t len = buf->len;
Expand Down
3 changes: 0 additions & 3 deletions src/unix/sunos.c
Expand Up @@ -183,8 +183,6 @@ int uv_fs_event_init(uv_loop_t* loop,
int portfd;
int first_run = 0;

loop->counters.fs_event_init++;

/* We don't support any flags yet. */
assert(!flags);
if (loop->fs_fd == -1) {
Expand Down Expand Up @@ -233,7 +231,6 @@ int uv_fs_event_init(uv_loop_t* loop,
const char* filename,
uv_fs_event_cb cb,
int flags) {
loop->counters.fs_event_init++;
uv__set_sys_error(loop, ENOSYS);
return -1;
}
Expand Down
1 change: 0 additions & 1 deletion src/unix/tcp.c
Expand Up @@ -30,7 +30,6 @@

int uv_tcp_init(uv_loop_t* loop, uv_tcp_t* tcp) {
uv__stream_init(loop, (uv_stream_t*)tcp, UV_TCP);
loop->counters.tcp_init++;
tcp->idle_handle = NULL;
return 0;
}
Expand Down
2 changes: 0 additions & 2 deletions src/unix/timer.c
Expand Up @@ -39,8 +39,6 @@ RB_GENERATE_STATIC(uv__timers, uv_timer_s, tree_entry, uv__timer_cmp)


int uv_timer_init(uv_loop_t* loop, uv_timer_t* handle) {
loop->counters.timer_init++;

uv__handle_init(loop, (uv_handle_t*)handle, UV_TIMER);
handle->timer_cb = NULL;

Expand Down
1 change: 0 additions & 1 deletion src/unix/tty.c
Expand Up @@ -45,7 +45,6 @@ int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd, int readable) {
tty->flags |= UV_STREAM_BLOCKING;
}

loop->counters.tty_init++;
tty->mode = 0;
return 0;
}
Expand Down
2 changes: 0 additions & 2 deletions src/unix/udp.c
Expand Up @@ -453,8 +453,6 @@ int uv_udp_init(uv_loop_t* loop, uv_udp_t* handle) {
memset(handle, 0, sizeof *handle);

uv__handle_init(loop, (uv_handle_t*)handle, UV_UDP);
loop->counters.udp_init++;

handle->fd = -1;
ngx_queue_init(&handle->write_queue);
ngx_queue_init(&handle->write_completed_queue);
Expand Down
1 change: 0 additions & 1 deletion src/uv-common.h
Expand Up @@ -158,7 +158,6 @@ UNUSED static void uv__handle_unref(uv_handle_t* h) {
UNUSED static void uv__handle_init(uv_loop_t* loop,
uv_handle_t* handle,
uv_handle_type type) {
loop->counters.handle_init++;
handle->loop = loop;
handle->type = type;
handle->flags = UV__HANDLE_REF; /* ref the loop when active */
Expand Down
2 changes: 0 additions & 2 deletions src/win/async.c
Expand Up @@ -78,8 +78,6 @@ int uv_async_init(uv_loop_t* loop, uv_async_t* handle, uv_async_cb async_cb) {
req->type = UV_WAKEUP;
req->data = handle;

loop->counters.async_init++;

uv__handle_start(handle);

return 0;
Expand Down
2 changes: 0 additions & 2 deletions src/win/core.c
Expand Up @@ -96,8 +96,6 @@ static void uv_loop_init(uv_loop_t* loop) {
loop->active_udp_streams = 0;

loop->last_err = uv_ok_;

memset(&loop->counters, 0, sizeof loop->counters);
}


Expand Down
2 changes: 0 additions & 2 deletions src/win/fs-event.c
Expand Up @@ -55,8 +55,6 @@ static void uv_fs_event_init_handle(uv_loop_t* loop, uv_fs_event_t* handle,
}

uv__handle_start(handle);

loop->counters.fs_event_init++;
}


Expand Down
1 change: 0 additions & 1 deletion src/win/loop-watcher.c
Expand Up @@ -39,7 +39,6 @@ void uv_loop_watcher_endgame(uv_loop_t* loop, uv_handle_t* handle) {
#define UV_LOOP_WATCHER_DEFINE(name, NAME) \
int uv_##name##_init(uv_loop_t* loop, uv_##name##_t* handle) { \
uv__handle_init(loop, (uv_handle_t*) handle, UV_##NAME); \
loop->counters.name##_init++; \
\
return 0; \
} \
Expand Down
2 changes: 0 additions & 2 deletions src/win/pipe.c
Expand Up @@ -88,8 +88,6 @@ int uv_pipe_init(uv_loop_t* loop, uv_pipe_t* handle, int ipc) {

uv_req_init(loop, (uv_req_t*) &handle->ipc_header_write_req);

loop->counters.pipe_init++;

return 0;
}

Expand Down
2 changes: 0 additions & 2 deletions src/win/poll.c
Expand Up @@ -558,8 +558,6 @@ int uv_poll_init_socket(uv_loop_t* loop, uv_poll_t* handle,
handle->poll_req_2.type = UV_POLL_REQ;
handle->poll_req_2.data = handle;

loop->counters.poll_init++;

return 0;
}

Expand Down
3 changes: 0 additions & 3 deletions src/win/process.c
Expand Up @@ -74,9 +74,6 @@ static void uv_process_init(uv_loop_t* loop, uv_process_t* handle) {
uv_req_init(loop, (uv_req_t*)&handle->close_req);
handle->close_req.type = UV_PROCESS_CLOSE;
handle->close_req.data = handle;

loop->counters.handle_init++;
loop->counters.process_init++;
}


Expand Down
1 change: 0 additions & 1 deletion src/win/req-inl.h
Expand Up @@ -80,7 +80,6 @@


INLINE static void uv_req_init(uv_loop_t* loop, uv_req_t* req) {
loop->counters.req_init++;
req->type = UV_UNKNOWN_REQ;
SET_REQ_SUCCESS(req);
}
Expand Down
2 changes: 0 additions & 2 deletions src/win/stream-inl.h
Expand Up @@ -36,8 +36,6 @@ INLINE static void uv_stream_init(uv_loop_t* loop,
uv__handle_init(loop, (uv_handle_t*) handle, type);
handle->write_queue_size = 0;
handle->activecnt = 0;

loop->counters.stream_init++;
}


Expand Down
2 changes: 0 additions & 2 deletions src/win/tcp.c
Expand Up @@ -149,8 +149,6 @@ int uv_tcp_init(uv_loop_t* loop, uv_tcp_t* handle) {
handle->func_connectex = NULL;
handle->processed_accepts = 0;

loop->counters.tcp_init++;

return 0;
}

Expand Down
2 changes: 0 additions & 2 deletions src/win/timer.c
Expand Up @@ -71,8 +71,6 @@ int uv_timer_init(uv_loop_t* loop, uv_timer_t* handle) {
handle->timer_cb = NULL;
handle->repeat = 0;

loop->counters.timer_init++;

return 0;
}

Expand Down
2 changes: 0 additions & 2 deletions src/win/tty.c
Expand Up @@ -92,8 +92,6 @@ int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, uv_file fd, int readable) {
HANDLE win_handle;
CONSOLE_SCREEN_BUFFER_INFO info;

loop->counters.tty_init++;

win_handle = (HANDLE) _get_osfhandle(fd);
if (win_handle == INVALID_HANDLE_VALUE) {
uv__set_sys_error(loop, ERROR_INVALID_HANDLE);
Expand Down
2 changes: 0 additions & 2 deletions src/win/udp.c
Expand Up @@ -135,8 +135,6 @@ int uv_udp_init(uv_loop_t* loop, uv_udp_t* handle) {
handle->recv_req.type = UV_UDP_RECV;
handle->recv_req.data = handle;

loop->counters.udp_init++;

return 0;
}

Expand Down

0 comments on commit 837edf4

Please sign in to comment.