Declare variables first please

This commit is contained in:
Bert Belder 2011-06-07 00:35:18 +02:00
parent 3d9b965aee
commit aa59c81d60
2 changed files with 5 additions and 2 deletions

View File

@ -142,6 +142,7 @@ void timer_cb(uv_handle_t* handle, int status) {
* calling uv_close when the client receives the EOF from echo-server. * calling uv_close when the client receives the EOF from echo-server.
*/ */
TEST_IMPL(shutdown_eof) { TEST_IMPL(shutdown_eof) {
struct sockaddr_in server_addr;
int r; int r;
uv_init(); uv_init();
@ -152,7 +153,7 @@ TEST_IMPL(shutdown_eof) {
uv_timer_init(&timer, timer_close_cb, NULL); uv_timer_init(&timer, timer_close_cb, NULL);
uv_timer_start(&timer, timer_cb, 100, 0); uv_timer_start(&timer, timer_cb, 100, 0);
struct sockaddr_in server_addr = uv_ip4_addr("127.0.0.1", TEST_PORT); server_addr = uv_ip4_addr("127.0.0.1", TEST_PORT);
r = uv_tcp_init(&tcp, tcp_close_cb, NULL); r = uv_tcp_init(&tcp, tcp_close_cb, NULL);
ASSERT(!r); ASSERT(!r);

View File

@ -64,10 +64,12 @@ static void close_cb(uv_handle_t* handle, int status) {
static void shutdown_cb(uv_req_t* req, int status) { static void shutdown_cb(uv_req_t* req, int status) {
uv_tcp_t* tcp;
ASSERT(req); ASSERT(req);
ASSERT(status == 0); ASSERT(status == 0);
uv_tcp_t* tcp = (uv_tcp_t*)(req->handle); tcp = (uv_tcp_t*)(req->handle);
/* The write buffer should be empty by now. */ /* The write buffer should be empty by now. */
ASSERT(tcp->write_queue_size == 0); ASSERT(tcp->write_queue_size == 0);