aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-08-14 17:01:36 -0700
committerGarrett D'Amore <garrett@damore.org>2017-08-14 17:01:36 -0700
commit6655557fca28408e0eeac3ba80b9e2bbdeada389 (patch)
treed7892ee947baf32426d42913be711c8506b7b7a7
parent97cb71c2f3e2a8ca041a24493761a7db98371710 (diff)
downloadnng-6655557fca28408e0eeac3ba80b9e2bbdeada389.tar.gz
nng-6655557fca28408e0eeac3ba80b9e2bbdeada389.tar.bz2
nng-6655557fca28408e0eeac3ba80b9e2bbdeada389.zip
Fix a few problems found by codacy. One was a real bug.
-rw-r--r--src/core/idhash.c1
-rw-r--r--src/core/msgqueue.c3
-rw-r--r--src/core/socket.c2
-rw-r--r--src/platform/posix/posix_epdesc.c1
4 files changed, 1 insertions, 6 deletions
diff --git a/src/core/idhash.c b/src/core/idhash.c
index 943809d7..ab6b67e1 100644
--- a/src/core/idhash.c
+++ b/src/core/idhash.c
@@ -153,7 +153,6 @@ nni_hash_resize(nni_idhash *h)
}
oldsize = h->ih_cap;
- newsize = h->ih_cap;
newsize = 8;
while (newsize < (h->ih_count * 2)) {
diff --git a/src/core/msgqueue.c b/src/core/msgqueue.c
index 8d0c3dbc..6530857e 100644
--- a/src/core/msgqueue.c
+++ b/src/core/msgqueue.c
@@ -374,7 +374,6 @@ int
nni_msgq_tryput(nni_msgq *mq, nni_msg *msg)
{
nni_aio *raio;
- size_t len = nni_msg_len(msg);
nni_mtx_lock(&mq->mq_lock);
if (mq->mq_closed) {
@@ -484,7 +483,6 @@ void
nni_msgq_close(nni_msgq *mq)
{
nni_aio *aio;
- nni_aio *naio;
nni_mtx_lock(&mq->mq_lock);
mq->mq_closed = 1;
@@ -500,7 +498,6 @@ nni_msgq_close(nni_msgq *mq)
}
// Let all pending blockers know we are closing the queue.
- naio = nni_list_first(&mq->mq_aio_getq);
while (((aio = nni_list_first(&mq->mq_aio_getq)) != NULL) ||
((aio = nni_list_first(&mq->mq_aio_putq)) != NULL)) {
nni_aio_list_remove(aio);
diff --git a/src/core/socket.c b/src/core/socket.c
index e01791a3..51ea9b55 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -91,7 +91,7 @@ nni_sock_pipe_start(nni_sock *s, nni_pipe *pipe)
rv = s->s_pipe_ops.pipe_start(pdata);
}
nni_mtx_unlock(&s->s_mx);
- return (0);
+ return (rv);
}
int
diff --git a/src/platform/posix/posix_epdesc.c b/src/platform/posix/posix_epdesc.c
index 7789f808..46fe2bea 100644
--- a/src/platform/posix/posix_epdesc.c
+++ b/src/platform/posix/posix_epdesc.c
@@ -63,7 +63,6 @@ nni_posix_epdesc_cancel(nni_aio *aio, int rv)
static void
nni_posix_epdesc_finish(nni_aio *aio, int rv, int newfd)
{
- nni_posix_epdesc * ed = aio->a_prov_data;
nni_posix_pipedesc *pd = NULL;
// acceptq or connectq.