From fb725c08938fbd81ee7fc538031103149deffbf9 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sun, 6 Jan 2013 22:27:40 +0100 Subject: [PATCH] test: simplify tcp_ref2b Said test doesn't need its own close callback, it can piggyback on the common close callback. --- test/test-ref.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/test/test-ref.c b/test/test-ref.c index abaaf0f8..7b1de1dd 100644 --- a/test/test-ref.c +++ b/test/test-ref.c @@ -240,19 +240,12 @@ TEST_IMPL(tcp_ref2) { } -static void tcp_ref2b_close_cb(uv_handle_t* handle) { - (*(int*) handle->data)++; -} - - TEST_IMPL(tcp_ref2b) { - int close_cb_called = 0; uv_tcp_t h; - h.data = &close_cb_called; uv_tcp_init(uv_default_loop(), &h); uv_listen((uv_stream_t*)&h, 128, (uv_connection_cb)fail_cb); uv_unref((uv_handle_t*)&h); - uv_close((uv_handle_t*)&h, tcp_ref2b_close_cb); + uv_close((uv_handle_t*)&h, close_cb); uv_run(uv_default_loop()); ASSERT(close_cb_called == 1); MAKE_VALGRIND_HAPPY();