aboutsummaryrefslogtreecommitdiff
path: root/src/core/message.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-04-24 16:39:35 -0700
committerGarrett D'Amore <garrett@damore.org>2018-04-24 16:39:35 -0700
commitd35973833e6bf05fec29100a4d5e66bb07b06659 (patch)
treeb380e99a092a0229c8f087d231306b398f6f43f2 /src/core/message.c
parent007f74b1053c9406340ffa728f9c254ba37e2a6c (diff)
downloadnng-d35973833e6bf05fec29100a4d5e66bb07b06659.tar.gz
nng-d35973833e6bf05fec29100a4d5e66bb07b06659.tar.bz2
nng-d35973833e6bf05fec29100a4d5e66bb07b06659.zip
fix a number of cppcheck complaints (not all)
Diffstat (limited to 'src/core/message.c')
-rw-r--r--src/core/message.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/core/message.c b/src/core/message.c
index 35153f01..5c396f21 100644
--- a/src/core/message.c
+++ b/src/core/message.c
@@ -1,6 +1,6 @@
//
-// Copyright 2017 Garrett D'Amore <garrett@damore.org>
-// Copyright 2017 Capitar IT Group BV <info@capitar.com>
+// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2018 Capitar IT Group BV <info@capitar.com>
//
// This software is supplied under the terms of the MIT License, a
// copy of which should be located in the distribution where this
@@ -102,7 +102,6 @@ nni_msg_dump(const char *banner, const nni_msg *msg)
static int
nni_chunk_grow(nni_chunk *ch, size_t newsz, size_t headwanted)
{
- size_t headroom = 0;
uint8_t *newbuf;
// We assume that if the pointer is a valid pointer, and inside
@@ -121,7 +120,7 @@ nni_chunk_grow(nni_chunk *ch, size_t newsz, size_t headwanted)
if ((ch->ch_ptr >= ch->ch_buf) &&
(ch->ch_ptr < (ch->ch_buf + ch->ch_cap))) {
- headroom = (size_t)(ch->ch_ptr - ch->ch_buf);
+ size_t headroom = (size_t)(ch->ch_ptr - ch->ch_buf);
if (headwanted < headroom) {
headwanted = headroom; // Never shrink this.
}
@@ -474,10 +473,9 @@ nni_msg_getopt(nni_msg *m, int opt, void *val, size_t *szp)
int
nni_msg_realloc(nni_msg *m, size_t sz)
{
- int rv = 0;
-
if (m->m_body.ch_len < sz) {
- rv = nni_chunk_append(&m->m_body, NULL, sz - m->m_body.ch_len);
+ int rv =
+ nni_chunk_append(&m->m_body, NULL, sz - m->m_body.ch_len);
if (rv != 0) {
return (rv);
}