Warning fixes in tests
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
diff --git a/tests/block.c b/tests/block.c
index edf1a1c..3d581ad 100644
--- a/tests/block.c
+++ b/tests/block.c
@@ -35,8 +35,6 @@
void worker (void *arg)
{
- int rc;
-
/* Wait 0.1 sec for the main thread to block. */
nn_sleep (100);
@@ -51,8 +49,6 @@
int main ()
{
- int rc;
- char buf [3];
struct nn_thread thread;
sb = test_socket (AF_SP, NN_PAIR);
diff --git a/tests/hash.c b/tests/hash.c
index 5cdae2d..68f1a76 100644
--- a/tests/hash.c
+++ b/tests/hash.c
@@ -30,7 +30,7 @@
struct nn_hash hash;
uint32_t k;
struct nn_hash_item *item;
- struct nn_hash_item *item5000;
+ struct nn_hash_item *item5000 = NULL;
nn_hash_init (&hash);
diff --git a/tests/inproc_shutdown.c b/tests/inproc_shutdown.c
index 226aad7..a0ac4d5 100644
--- a/tests/inproc_shutdown.c
+++ b/tests/inproc_shutdown.c
@@ -35,7 +35,6 @@
static void routine (void *arg)
{
- int rc;
int s;
s = nn_socket (AF_SP, NN_SUB);
@@ -48,7 +47,6 @@
int main ()
{
- int rc;
int sb;
int i;
int j;
diff --git a/tests/ipc.c b/tests/ipc.c
index 4135b27..3801175 100644
--- a/tests/ipc.c
+++ b/tests/ipc.c
@@ -34,11 +34,9 @@
int main ()
{
#if !defined NN_HAVE_WINDOWS
- int rc;
int sb;
int sc;
int i;
- char buf [3];
/* Try closing a IPC socket while it not connected. */
sc = test_socket (AF_SP, NN_PAIR);
diff --git a/tests/ipc_shutdown.c b/tests/ipc_shutdown.c
index 1d05bec..e912d28 100644
--- a/tests/ipc_shutdown.c
+++ b/tests/ipc_shutdown.c
@@ -35,7 +35,6 @@
static void routine (void *arg)
{
- int rc;
int s;
s = nn_socket (AF_SP, NN_SUB);
@@ -49,7 +48,6 @@
int main ()
{
#if !defined NN_HAVE_WINDOWS
- int rc;
int sb;
int i;
int j;
diff --git a/tests/pair.c b/tests/pair.c
index 387ea7e..a1333bb 100644
--- a/tests/pair.c
+++ b/tests/pair.c
@@ -29,10 +29,8 @@
int main ()
{
- int rc;
int sb;
int sc;
- char buf [3];
sb = test_socket (AF_SP, NN_PAIR);
test_bind (sb, SOCKET_ADDRESS);
diff --git a/tests/pipeline.c b/tests/pipeline.c
index 61f1a4a..9fe4a16 100644
--- a/tests/pipeline.c
+++ b/tests/pipeline.c
@@ -29,12 +29,10 @@
int main ()
{
- int rc;
int push1;
int push2;
int pull1;
int pull2;
- char buf [3];
/* Test fan-out. */
diff --git a/tests/poll.c b/tests/poll.c
index 0a75cdb..7afe9b8 100644
--- a/tests/poll.c
+++ b/tests/poll.c
@@ -41,8 +41,6 @@
void routine1 (void *arg)
{
- int rc;
-
nn_sleep (10);
test_send (sc, "ABC");
}
diff --git a/tests/prio.c b/tests/prio.c
index dbcb72d..2330647 100644
--- a/tests/prio.c
+++ b/tests/prio.c
@@ -36,7 +36,6 @@
int pull1;
int pull2;
int sndprio;
- char buf [3];
pull1 = test_socket (AF_SP, NN_PULL);
test_bind (pull1, SOCKET_ADDRESS_A);
diff --git a/tests/pubsub.c b/tests/pubsub.c
index 44d24f0..e3e9748 100644
--- a/tests/pubsub.c
+++ b/tests/pubsub.c
@@ -34,7 +34,6 @@
int pub2;
int sub1;
int sub2;
- char buf [3];
pub1 = test_socket (AF_SP, NN_PUB);
test_bind (pub1, SOCKET_ADDRESS);
diff --git a/tests/tcp_shutdown.c b/tests/tcp_shutdown.c
index 2a8b4d9..4d328b4 100644
--- a/tests/tcp_shutdown.c
+++ b/tests/tcp_shutdown.c
@@ -35,7 +35,6 @@
static void routine (void *arg)
{
- int rc;
int s;
s = nn_socket (AF_SP, NN_SUB);
@@ -48,7 +47,6 @@
int main ()
{
- int rc;
int sb;
int i;
int j;
diff --git a/tests/testutil.h b/tests/testutil.h
index 0664098..81f9cd7 100644
--- a/tests/testutil.h
+++ b/tests/testutil.h
@@ -55,7 +55,7 @@
return sock;
}
-static int test_connect_impl (char *file, int line, int sock, char *address)
+static inline int test_connect_impl (char *file, int line, int sock, char *address)
{
int rc;
@@ -70,7 +70,7 @@
return rc;
}
-static int test_bind_impl (char *file, int line, int sock, char *address)
+static inline int test_bind_impl (char *file, int line, int sock, char *address)
{
int rc;
@@ -98,7 +98,7 @@
}
}
-static void test_send_impl (char *file, int line, int sock, char *data)
+static inline void test_send_impl (char *file, int line, int sock, char *data)
{
size_t data_len;
int rc;
@@ -115,13 +115,12 @@
if (rc != data_len) {
fprintf (stderr, "Data to send is truncated: %d != %d (%s:%d)\n",
rc, (int) data_len,
- nn_err_strerror (errno),
- (int) errno, file, line);
+ file, line);
nn_err_abort ();
}
}
-static void test_recv_impl (char *file, int line, int sock, char *data)
+static inline void test_recv_impl (char *file, int line, int sock, char *data)
{
size_t data_len;
int rc;
@@ -143,8 +142,7 @@
if (rc != data_len) {
fprintf (stderr, "Received data has wrong length: %d != %d (%s:%d)\n",
rc, (int) data_len,
- nn_err_strerror (errno),
- (int) errno, file, line);
+ file, line);
nn_err_abort ();
}
if (memcmp (data, buf, data_len) != 0) {