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

Commit

Permalink
Browse files Browse the repository at this point in the history
unix, windows: removed unused status parameter
async, timer, prepare, idle and check handles don't need the status
parameter.
  • Loading branch information
saghul committed Mar 17, 2014
1 parent a2506c9 commit db2a907
Show file tree
Hide file tree
Showing 53 changed files with 105 additions and 139 deletions.
11 changes: 5 additions & 6 deletions include/uv.h
Expand Up @@ -405,12 +405,11 @@ typedef void (*uv_shutdown_cb)(uv_shutdown_t* req, int status);
typedef void (*uv_connection_cb)(uv_stream_t* server, int status);
typedef void (*uv_close_cb)(uv_handle_t* handle);
typedef void (*uv_poll_cb)(uv_poll_t* handle, int status, int events);
typedef void (*uv_timer_cb)(uv_timer_t* handle, int status);
/* TODO: do these really need a status argument? */
typedef void (*uv_async_cb)(uv_async_t* handle, int status);
typedef void (*uv_prepare_cb)(uv_prepare_t* handle, int status);
typedef void (*uv_check_cb)(uv_check_t* handle, int status);
typedef void (*uv_idle_cb)(uv_idle_t* handle, int status);
typedef void (*uv_timer_cb)(uv_timer_t* handle);
typedef void (*uv_async_cb)(uv_async_t* handle);
typedef void (*uv_prepare_cb)(uv_prepare_t* handle);
typedef void (*uv_check_cb)(uv_check_t* handle);
typedef void (*uv_idle_cb)(uv_idle_t* handle);
typedef void (*uv_exit_cb)(uv_process_t*, int64_t exit_status, int term_signal);
typedef void (*uv_walk_cb)(uv_handle_t* handle, void* arg);
typedef void (*uv_fs_cb)(uv_fs_t* req);
Expand Down
4 changes: 2 additions & 2 deletions src/fs-poll.c
Expand Up @@ -41,7 +41,7 @@ struct poll_ctx {

static int statbuf_eq(const uv_stat_t* a, const uv_stat_t* b);
static void poll_cb(uv_fs_t* req);
static void timer_cb(uv_timer_t* timer, int status);
static void timer_cb(uv_timer_t* timer);
static void timer_close_cb(uv_handle_t* handle);

static uv_stat_t zero_statbuf;
Expand Down Expand Up @@ -148,7 +148,7 @@ void uv__fs_poll_close(uv_fs_poll_t* handle) {
}


static void timer_cb(uv_timer_t* timer, int status) {
static void timer_cb(uv_timer_t* timer) {
struct poll_ctx* ctx;

ctx = container_of(timer, struct poll_ctx, timer_handle);
Expand Down
2 changes: 1 addition & 1 deletion src/unix/async.c
Expand Up @@ -85,7 +85,7 @@ static void uv__async_event(uv_loop_t* loop,

if (h->async_cb == NULL)
continue;
h->async_cb(h, 0);
h->async_cb(h);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/unix/internal.h
Expand Up @@ -214,7 +214,7 @@ void uv__work_submit(uv_loop_t* loop,
struct uv__work *w,
void (*work)(struct uv__work *w),
void (*done)(struct uv__work *w, int status));
void uv__work_done(uv_async_t* handle, int status);
void uv__work_done(uv_async_t* handle);

/* platform specific */
uint64_t uv__hrtime(uv_clocktype_t type);
Expand Down
2 changes: 1 addition & 1 deletion src/unix/loop-watcher.c
Expand Up @@ -50,7 +50,7 @@
QUEUE* q; \
QUEUE_FOREACH(q, &loop->name##_handles) { \
h = QUEUE_DATA(q, uv_##name##_t, queue); \
h->name##_cb(h, 0); \
h->name##_cb(h); \
} \
} \
\
Expand Down
2 changes: 1 addition & 1 deletion src/unix/threadpool.c
Expand Up @@ -191,7 +191,7 @@ static int uv__work_cancel(uv_loop_t* loop, uv_req_t* req, struct uv__work* w) {
}


void uv__work_done(uv_async_t* handle, int status) {
void uv__work_done(uv_async_t* handle) {
struct uv__work* w;
uv_loop_t* loop;
QUEUE* q;
Expand Down
2 changes: 1 addition & 1 deletion src/unix/timer.c
Expand Up @@ -159,7 +159,7 @@ void uv__run_timers(uv_loop_t* loop) {

uv_timer_stop(handle);
uv_timer_again(handle);
handle->timer_cb(handle, 0);
handle->timer_cb(handle);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/win/async.c
Expand Up @@ -94,6 +94,6 @@ void uv_process_async_wakeup_req(uv_loop_t* loop, uv_async_t* handle,
if (handle->flags & UV__HANDLE_CLOSING) {
uv_want_endgame(loop, (uv_handle_t*)handle);
} else if (handle->async_cb != NULL) {
handle->async_cb(handle, 0);
handle->async_cb(handle);
}
}
2 changes: 1 addition & 1 deletion src/win/loop-watcher.c
Expand Up @@ -115,7 +115,7 @@ void uv_loop_watcher_endgame(uv_loop_t* loop, uv_handle_t* handle) {
handle = (loop)->next_##name##_handle; \
(loop)->next_##name##_handle = handle->name##_next; \
\
handle->name##_cb(handle, 0); \
handle->name##_cb(handle); \
} \
}

Expand Down
5 changes: 2 additions & 3 deletions src/win/pipe.c
Expand Up @@ -79,7 +79,7 @@ typedef struct {
static void eof_timer_init(uv_pipe_t* pipe);
static void eof_timer_start(uv_pipe_t* pipe);
static void eof_timer_stop(uv_pipe_t* pipe);
static void eof_timer_cb(uv_timer_t* timer, int status);
static void eof_timer_cb(uv_timer_t* timer);
static void eof_timer_destroy(uv_pipe_t* pipe);
static void eof_timer_close_cb(uv_handle_t* handle);

Expand Down Expand Up @@ -1695,11 +1695,10 @@ static void eof_timer_stop(uv_pipe_t* pipe) {
}


static void eof_timer_cb(uv_timer_t* timer, int status) {
static void eof_timer_cb(uv_timer_t* timer) {
uv_pipe_t* pipe = (uv_pipe_t*) timer->data;
uv_loop_t* loop = timer->loop;

assert(status == 0); /* timers can't fail */
assert(pipe->type == UV_NAMED_PIPE);

/* This should always be true, since we start the timer only */
Expand Down
2 changes: 1 addition & 1 deletion src/win/timer.c
Expand Up @@ -249,6 +249,6 @@ void uv_process_timers(uv_loop_t* loop) {
uv__handle_stop(timer);
}

timer->timer_cb((uv_timer_t*) timer, 0);
timer->timer_cb((uv_timer_t*) timer);
}
}
2 changes: 1 addition & 1 deletion test/benchmark-async-pummel.c
Expand Up @@ -36,7 +36,7 @@ static const char stop[] = "stop";
static const char stopped[] = "stopped";


static void async_cb(uv_async_t* handle, int status) {
static void async_cb(uv_async_t* handle) {
if (++callbacks == NUM_PINGS) {
/* Tell the pummel thread to stop. */
ACCESS_ONCE(const char*, handle->data) = stop;
Expand Down
4 changes: 2 additions & 2 deletions test/benchmark-async.c
Expand Up @@ -40,7 +40,7 @@ struct ctx {
};


static void worker_async_cb(uv_async_t* handle, int status) {
static void worker_async_cb(uv_async_t* handle) {
struct ctx* ctx = container_of(handle, struct ctx, worker_async);

ASSERT(0 == uv_async_send(&ctx->main_async));
Expand All @@ -52,7 +52,7 @@ static void worker_async_cb(uv_async_t* handle, int status) {
}


static void main_async_cb(uv_async_t* handle, int status) {
static void main_async_cb(uv_async_t* handle) {
struct ctx* ctx = container_of(handle, struct ctx, main_async);

ASSERT(0 == uv_async_send(&ctx->worker_async));
Expand Down
6 changes: 3 additions & 3 deletions test/benchmark-loop-count.c
Expand Up @@ -32,18 +32,18 @@ static uv_idle_t idle_handle;
static uv_timer_t timer_handle;


static void idle_cb(uv_idle_t* handle, int status) {
static void idle_cb(uv_idle_t* handle) {
if (++ticks == NUM_TICKS)
uv_idle_stop(handle);
}


static void idle2_cb(uv_idle_t* handle, int status) {
static void idle2_cb(uv_idle_t* handle) {
ticks++;
}


static void timer_cb(uv_timer_t* handle, int status) {
static void timer_cb(uv_timer_t* handle) {
uv_idle_stop(&idle_handle);
uv_timer_stop(&timer_handle);
}
Expand Down
4 changes: 2 additions & 2 deletions test/benchmark-million-async.c
Expand Up @@ -50,13 +50,13 @@ static void thread_cb(void* arg) {
}


static void async_cb(uv_async_t* handle, int status) {
static void async_cb(uv_async_t* handle) {
container->async_events++;
handle->data = handle;
}


static void timer_cb(uv_timer_t* handle, int status) {
static void timer_cb(uv_timer_t* handle) {
unsigned i;

done = 1;
Expand Down
2 changes: 1 addition & 1 deletion test/benchmark-million-timers.c
Expand Up @@ -28,7 +28,7 @@ static int timer_cb_called;
static int close_cb_called;


static void timer_cb(uv_timer_t* handle, int status) {
static void timer_cb(uv_timer_t* handle) {
timer_cb_called++;
}

Expand Down
8 changes: 4 additions & 4 deletions test/benchmark-multi-accept.c
Expand Up @@ -90,15 +90,15 @@ static void ipc_alloc_cb(uv_handle_t* handle,
size_t suggested_size,
uv_buf_t* buf);

static void sv_async_cb(uv_async_t* handle, int status);
static void sv_async_cb(uv_async_t* handle);
static void sv_connection_cb(uv_stream_t* server_handle, int status);
static void sv_read_cb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf);
static void sv_alloc_cb(uv_handle_t* handle,
size_t suggested_size,
uv_buf_t* buf);

static void cl_connect_cb(uv_connect_t* req, int status);
static void cl_idle_cb(uv_idle_t* handle, int status);
static void cl_idle_cb(uv_idle_t* handle);
static void cl_close_cb(uv_handle_t* handle);

static struct sockaddr_in listen_addr;
Expand Down Expand Up @@ -275,7 +275,7 @@ static void server_cb(void *arg) {
}


static void sv_async_cb(uv_async_t* handle, int status) {
static void sv_async_cb(uv_async_t* handle) {
struct server_ctx* ctx;
ctx = container_of(handle, struct server_ctx, async_handle);
uv_close((uv_handle_t*) &ctx->server_handle, NULL);
Expand Down Expand Up @@ -330,7 +330,7 @@ static void cl_connect_cb(uv_connect_t* req, int status) {
}


static void cl_idle_cb(uv_idle_t* handle, int status) {
static void cl_idle_cb(uv_idle_t* handle) {
struct client_ctx* ctx = container_of(handle, struct client_ctx, idle_handle);
uv_close((uv_handle_t*) &ctx->client_handle, cl_close_cb);
uv_idle_stop(&ctx->idle_handle);
Expand Down
2 changes: 1 addition & 1 deletion test/benchmark-pump.c
Expand Up @@ -85,7 +85,7 @@ static double gbit(int64_t bytes, int64_t passed_ms) {
}


static void show_stats(uv_timer_t* handle, int status) {
static void show_stats(uv_timer_t* handle) {
int64_t diff;
int i;

Expand Down
2 changes: 1 addition & 1 deletion test/benchmark-udp-pummel.c
Expand Up @@ -132,7 +132,7 @@ static void close_cb(uv_handle_t* handle) {
}


static void timeout_cb(uv_timer_t* timer, int status) {
static void timeout_cb(uv_timer_t* timer) {
int i;

exiting = 1;
Expand Down
2 changes: 1 addition & 1 deletion test/test-active.c
Expand Up @@ -35,7 +35,7 @@ static void close_cb(uv_handle_t* handle) {
}


static void timer_cb(uv_timer_t* handle, int status) {
static void timer_cb(uv_timer_t* handle) {
ASSERT(0 && "timer_cb should not have been called");
}

Expand Down
2 changes: 1 addition & 1 deletion test/test-async-null-cb.c
Expand Up @@ -34,7 +34,7 @@ static void thread_cb(void* dummy) {
}


static void check_cb(uv_check_t* handle, int status) {
static void check_cb(uv_check_t* handle) {
ASSERT(check_cb_called == 0);
uv_close((uv_handle_t*) &async_handle, NULL);
uv_close((uv_handle_t*) &check_handle, NULL);
Expand Down
6 changes: 2 additions & 4 deletions test/test-async.c
Expand Up @@ -75,11 +75,10 @@ static void close_cb(uv_handle_t* handle) {
}


static void async_cb(uv_async_t* handle, int status) {
static void async_cb(uv_async_t* handle) {
int n;

ASSERT(handle == &async);
ASSERT(status == 0);

uv_mutex_lock(&mutex);
n = ++async_cb_called;
Expand All @@ -92,11 +91,10 @@ static void async_cb(uv_async_t* handle, int status) {
}


static void prepare_cb(uv_prepare_t* handle, int status) {
static void prepare_cb(uv_prepare_t* handle) {
int r;

ASSERT(handle == &prepare);
ASSERT(status == 0);

if (prepare_cb_called++)
return;
Expand Down
6 changes: 3 additions & 3 deletions test/test-callback-order.c
Expand Up @@ -30,23 +30,23 @@ static uv_timer_t timer_handle;


/* idle_cb should run before timer_cb */
static void idle_cb(uv_idle_t* handle, int status) {
static void idle_cb(uv_idle_t* handle) {
ASSERT(idle_cb_called == 0);
ASSERT(timer_cb_called == 0);
uv_idle_stop(handle);
idle_cb_called++;
}


static void timer_cb(uv_timer_t* handle, int status) {
static void timer_cb(uv_timer_t* handle) {
ASSERT(idle_cb_called == 1);
ASSERT(timer_cb_called == 0);
uv_timer_stop(handle);
timer_cb_called++;
}


static void next_tick(uv_idle_t* handle, int status) {
static void next_tick(uv_idle_t* handle) {
uv_loop_t* loop = handle->loop;
uv_idle_stop(handle);
uv_idle_init(loop, &idle_handle);
Expand Down
3 changes: 1 addition & 2 deletions test/test-callback-stack.c
Expand Up @@ -105,9 +105,8 @@ static void read_cb(uv_stream_t* tcp, ssize_t nread, const uv_buf_t* buf) {
}


static void timer_cb(uv_timer_t* handle, int status) {
static void timer_cb(uv_timer_t* handle) {
ASSERT(handle == &timer);
ASSERT(status == 0);
ASSERT(nested == 0 && "timer_cb must be called from a fresh stack");

puts("Timeout complete. Now read data...");
Expand Down
4 changes: 2 additions & 2 deletions test/test-close-order.c
Expand Up @@ -38,7 +38,7 @@ static void close_cb(uv_handle_t* handle) {


/* check_cb should run before any close_cb */
static void check_cb(uv_check_t* handle, int status) {
static void check_cb(uv_check_t* handle) {
ASSERT(check_cb_called == 0);
ASSERT(timer_cb_called == 1);
ASSERT(close_cb_called == 0);
Expand All @@ -48,7 +48,7 @@ static void check_cb(uv_check_t* handle, int status) {
}


static void timer_cb(uv_timer_t* handle, int status) {
static void timer_cb(uv_timer_t* handle) {
uv_close((uv_handle_t*) handle, close_cb);
timer_cb_called++;
}
Expand Down
3 changes: 1 addition & 2 deletions test/test-connection-fail.c
Expand Up @@ -46,8 +46,7 @@ static void timer_close_cb(uv_handle_t* handle) {
}


static void timer_cb(uv_timer_t* handle, int status) {
ASSERT(status == 0);
static void timer_cb(uv_timer_t* handle) {
timer_cb_calls++;

/*
Expand Down
3 changes: 1 addition & 2 deletions test/test-delayed-accept.c
Expand Up @@ -45,13 +45,12 @@ static void close_cb(uv_handle_t* handle) {
}


static void do_accept(uv_timer_t* timer_handle, int status) {
static void do_accept(uv_timer_t* timer_handle) {
uv_tcp_t* server;
uv_tcp_t* accepted_handle = (uv_tcp_t*)malloc(sizeof *accepted_handle);
int r;

ASSERT(timer_handle != NULL);
ASSERT(status == 0);
ASSERT(accepted_handle != NULL);

r = uv_tcp_init(uv_default_loop(), accepted_handle);
Expand Down
4 changes: 2 additions & 2 deletions test/test-embed.c
Expand Up @@ -90,14 +90,14 @@ static void embed_thread_runner(void* arg) {
}


static void embed_cb(uv_async_t* async, int status) {
static void embed_cb(uv_async_t* async) {
uv_run(uv_default_loop(), UV_RUN_ONCE);

uv_sem_post(&embed_sem);
}


static void embed_timer_cb(uv_timer_t* timer, int status) {
static void embed_timer_cb(uv_timer_t* timer) {
embed_timer_called++;
embed_closed = 1;

Expand Down

0 comments on commit db2a907

Please sign in to comment.