From 24e24c8ac8d05c1e72ef5d71029d24e8832b49a4 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 7 Aug 2017 16:28:36 -0700 Subject: Remove some dead code; msg queue depths are always unsigned. --- src/core/msgqueue.c | 38 +------------------------------------- 1 file changed, 1 insertion(+), 37 deletions(-) (limited to 'src/core/msgqueue.c') diff --git a/src/core/msgqueue.c b/src/core/msgqueue.c index 2ebc4927..3972e07a 100644 --- a/src/core/msgqueue.c +++ b/src/core/msgqueue.c @@ -36,16 +36,12 @@ struct nni_msgq { }; int -nni_msgq_init(nni_msgq **mqp, int cap) +nni_msgq_init(nni_msgq **mqp, unsigned cap) { struct nni_msgq *mq; int rv; int alloc; - if (cap < 0) { - return (NNG_EINVAL); - } - // We allocate 2 extra cells in the fifo. One to accommodate a // waiting writer when cap == 0. (We can "briefly" move the message // through.) This lets us behave the same as unbuffered Go channels. @@ -374,38 +370,6 @@ nni_msgq_aio_get(nni_msgq *mq, nni_aio *aio) nni_mtx_unlock(&mq->mq_lock); } -int -nni_msgq_canput(nni_msgq *mq) -{ - nni_mtx_lock(&mq->mq_lock); - if (mq->mq_closed) { - nni_mtx_unlock(&mq->mq_lock); - return (0); - } - if ((mq->mq_len < mq->mq_cap) || !nni_list_empty(&mq->mq_aio_getq)) { - nni_mtx_unlock(&mq->mq_lock); - return (1); - } - nni_mtx_unlock(&mq->mq_lock); - return (0); -} - -int -nni_msgq_canget(nni_msgq *mq) -{ - nni_mtx_lock(&mq->mq_lock); - if (mq->mq_closed) { - nni_mtx_unlock(&mq->mq_lock); - return (0); - } - if ((mq->mq_len != 0) || !nni_list_empty(&mq->mq_aio_putq)) { - nni_mtx_unlock(&mq->mq_lock); - return (1); - } - nni_mtx_unlock(&mq->mq_lock); - return (0); -} - int nni_msgq_tryput(nni_msgq *mq, nni_msg *msg) { -- cgit v1.2.3-70-g09d2