diff --git a/test/benchmark-ping-pongs.c b/test/benchmark-ping-pongs.c index 43a13216..368380ea 100644 --- a/test/benchmark-ping-pongs.c +++ b/test/benchmark-ping-pongs.c @@ -46,13 +46,13 @@ typedef struct buf_s { static char PING[] = "PING\n"; -buf_t* buf_freelist = NULL; +static buf_t* buf_freelist = NULL; static int completed_pingers = 0; static int64_t start_time; -oio_buf buf_alloc(oio_handle* handle, size_t size) { +static oio_buf buf_alloc(oio_handle* handle, size_t size) { buf_t* ab; ab = buf_freelist; @@ -70,7 +70,7 @@ oio_buf buf_alloc(oio_handle* handle, size_t size) { } -void buf_free(oio_buf oio_buf) { +static void buf_free(oio_buf oio_buf) { buf_t* ab = (buf_t*) (oio_buf.base - sizeof *ab); ab->next = buf_freelist; @@ -78,7 +78,7 @@ void buf_free(oio_buf oio_buf) { } -void pinger_close_cb(oio_handle* handle, int status) { +static void pinger_close_cb(oio_handle* handle, int status) { pinger_t* pinger; ASSERT(status == 0); @@ -92,7 +92,7 @@ void pinger_close_cb(oio_handle* handle, int status) { } -void pinger_write_cb(oio_req *req, int status) { +static void pinger_write_cb(oio_req *req, int status) { ASSERT(status == 0); free(req); @@ -157,7 +157,7 @@ static void pinger_read_cb(oio_handle* handle, int nread, oio_buf buf) { } -void pinger_connect_cb(oio_req *req, int status) { +static void pinger_connect_cb(oio_req *req, int status) { pinger_t *pinger = (pinger_t*)req->handle->data; ASSERT(status == 0); @@ -170,7 +170,7 @@ void pinger_connect_cb(oio_req *req, int status) { } -void pinger_new() { +static void pinger_new() { int r; struct sockaddr_in client_addr = oio_ip4_addr("0.0.0.0", 0); struct sockaddr_in server_addr = oio_ip4_addr("127.0.0.1", TEST_PORT); diff --git a/test/echo-server.c b/test/echo-server.c index 8ecbd61a..ee3c925c 100644 --- a/test/echo-server.c +++ b/test/echo-server.c @@ -31,16 +31,16 @@ typedef struct { } write_req_t; -oio_handle server; +static oio_handle server; -void after_write(oio_req* req, int status); -void after_read(oio_handle* handle, int nread, oio_buf buf); -void on_close(oio_handle* peer, int status); -void on_accept(oio_handle* handle); +static void after_write(oio_req* req, int status); +static void after_read(oio_handle* handle, int nread, oio_buf buf); +static void on_close(oio_handle* peer, int status); +static void on_accept(oio_handle* handle); -void after_write(oio_req* req, int status) { +static void after_write(oio_req* req, int status) { write_req_t* wr; if (status) { @@ -57,12 +57,12 @@ void after_write(oio_req* req, int status) { } -void after_shutdown(oio_req* req, int status) { +static void after_shutdown(oio_req* req, int status) { free(req); } -void after_read(oio_handle* handle, int nread, oio_buf buf) { +static void after_read(oio_handle* handle, int nread, oio_buf buf) { write_req_t *wr; oio_req* req; @@ -98,14 +98,14 @@ void after_read(oio_handle* handle, int nread, oio_buf buf) { } -void on_close(oio_handle* peer, int status) { +static void on_close(oio_handle* peer, int status) { if (status != 0) { fprintf(stdout, "Socket error\n"); } } -void on_accept(oio_handle* server) { +static void on_accept(oio_handle* server) { oio_handle* handle = (oio_handle*) malloc(sizeof *handle); if (oio_accept(server, handle, on_close, NULL)) { @@ -116,13 +116,13 @@ void on_accept(oio_handle* server) { } -void on_server_close(oio_handle* handle, int status) { +static void on_server_close(oio_handle* handle, int status) { ASSERT(handle == &server); ASSERT(status == 0); } -int echo_start(int port) { +static int echo_start(int port) { struct sockaddr_in addr = oio_ip4_addr("0.0.0.0", port); int r; @@ -151,12 +151,12 @@ int echo_start(int port) { } -int echo_stop() { +static int echo_stop() { return oio_close(&server); } -oio_buf echo_alloc(oio_handle* handle, size_t suggested_size) { +static oio_buf echo_alloc(oio_handle* handle, size_t suggested_size) { oio_buf buf; buf.base = (char*) malloc(suggested_size); buf.len = suggested_size; diff --git a/test/test-callback-stack.c b/test/test-callback-stack.c index 33793f54..edf42d9d 100644 --- a/test/test-callback-stack.c +++ b/test/test-callback-stack.c @@ -28,21 +28,21 @@ #include "task.h" -const char MESSAGE[] = "Failure is for the weak. Everyone dies alone."; +static const char MESSAGE[] = "Failure is for the weak. Everyone dies alone."; -oio_handle client; -oio_req connect_req, write_req, timeout_req, shutdown_req; +static oio_handle client; +static oio_req connect_req, write_req, timeout_req, shutdown_req; -int nested = 0; -int close_cb_called = 0; -int connect_cb_called = 0; -int write_cb_called = 0; -int timeout_cb_called = 0; -int bytes_received = 0; -int shutdown_cb_called = 0; +static int nested = 0; +static int close_cb_called = 0; +static int connect_cb_called = 0; +static int write_cb_called = 0; +static int timeout_cb_called = 0; +static int bytes_received = 0; +static int shutdown_cb_called = 0; -void close_cb(oio_handle* handle, int status) { +static void close_cb(oio_handle* handle, int status) { ASSERT(status == 0); ASSERT(nested == 0 && "close_cb must be called from a fresh stack"); @@ -50,7 +50,7 @@ void close_cb(oio_handle* handle, int status) { } -void shutdown_cb(oio_req* req, int status) { +static void shutdown_cb(oio_req* req, int status) { ASSERT(status == 0); ASSERT(nested == 0 && "shutdown_cb must be called from a fresh stack"); @@ -58,7 +58,7 @@ void shutdown_cb(oio_req* req, int status) { } -void read_cb(oio_handle* handle, int nread, oio_buf buf) { +static void read_cb(oio_handle* handle, int nread, oio_buf buf) { ASSERT(nested == 0 && "read_cb must be called from a fresh stack"); printf("Read. nread == %d\n", nread); @@ -100,7 +100,7 @@ void read_cb(oio_handle* handle, int nread, oio_buf buf) { } -void timeout_cb(oio_req* req, int64_t skew, int status) { +static void timeout_cb(oio_req* req, int64_t skew, int status) { ASSERT(status == 0); ASSERT(nested == 0 && "timeout_cb must be called from a fresh stack"); @@ -116,7 +116,7 @@ void timeout_cb(oio_req* req, int64_t skew, int status) { } -void write_cb(oio_req* req, int status) { +static void write_cb(oio_req* req, int status) { ASSERT(status == 0); ASSERT(nested == 0 && "write_cb must be called from a fresh stack"); @@ -137,7 +137,7 @@ void write_cb(oio_req* req, int status) { } -void connect_cb(oio_req* req, int status) { +static void connect_cb(oio_req* req, int status) { oio_buf buf; puts("Connected. Write some data to echo server..."); diff --git a/test/test-ping-pong.c b/test/test-ping-pong.c index 21ebadf5..afba7579 100644 --- a/test/test-ping-pong.c +++ b/test/test-ping-pong.c @@ -48,7 +48,7 @@ typedef struct { void pinger_try_read(pinger_t* pinger); -void pinger_on_close(oio_handle* handle, int status) { +static void pinger_on_close(oio_handle* handle, int status) { pinger_t* pinger = (pinger_t*)handle->data; ASSERT(status == 0); @@ -60,7 +60,7 @@ void pinger_on_close(oio_handle* handle, int status) { } -void pinger_after_write(oio_req *req, int status) { +static void pinger_after_write(oio_req *req, int status) { ASSERT(status == 0); free(req); @@ -123,7 +123,7 @@ static void pinger_read_cb(oio_handle* handle, int nread, oio_buf buf) { } -void pinger_on_connect(oio_req *req, int status) { +static void pinger_on_connect(oio_req *req, int status) { pinger_t *pinger = (pinger_t*)req->handle->data; ASSERT(status == 0); @@ -134,7 +134,7 @@ void pinger_on_connect(oio_req *req, int status) { } -void pinger_new() { +static void pinger_new() { int r; struct sockaddr_in server_addr = oio_ip4_addr("127.0.0.1", TEST_PORT); pinger_t *pinger;