summaryrefslogtreecommitdiffstats
path: root/lib/imsg.c
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas.abraitis@gmail.com>2020-02-09 13:21:56 +0100
committerDonatas Abraitis <donatas.abraitis@gmail.com>2020-02-09 13:21:56 +0100
commit95f7965d09a6eb4447c0de5a679114492cac3f37 (patch)
tree1bfa78792b4f62934a483104e921f0bff5809590 /lib/imsg.c
parenttools: Add coccinelle script to remove parenthesis on return (diff)
downloadfrr-95f7965d09a6eb4447c0de5a679114492cac3f37.tar.xz
frr-95f7965d09a6eb4447c0de5a679114492cac3f37.zip
*: Remove parenthesis on return for constants
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
Diffstat (limited to 'lib/imsg.c')
-rw-r--r--lib/imsg.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/lib/imsg.c b/lib/imsg.c
index f07c56f0a..b46d5cbc2 100644
--- a/lib/imsg.c
+++ b/lib/imsg.c
@@ -37,7 +37,7 @@ static int available_fds(unsigned int n)
int ret, fds[256];
if (n > (unsigned int)array_size(fds))
- return (1);
+ return 1;
ret = 0;
for (i = 0; i < n; i++) {
@@ -93,7 +93,7 @@ ssize_t imsg_read(struct imsgbuf *ibuf)
msg.msg_controllen = sizeof(cmsgbuf.buf);
if ((ifd = calloc(1, sizeof(struct imsg_fd))) == NULL)
- return (-1);
+ return -1;
again:
#ifdef __OpenBSD__
@@ -108,7 +108,7 @@ again:
#endif
errno = EAGAIN;
free(ifd);
- return (-1);
+ return -1;
}
n = recvmsg(ibuf->fd, &msg, 0);
@@ -161,21 +161,21 @@ ssize_t imsg_get(struct imsgbuf *ibuf, struct imsg *imsg)
av = ibuf->r.wpos;
if (IMSG_HEADER_SIZE > av)
- return (0);
+ return 0;
memcpy(&imsg->hdr, ibuf->r.buf, sizeof(imsg->hdr));
if (imsg->hdr.len < IMSG_HEADER_SIZE || imsg->hdr.len > MAX_IMSGSIZE) {
errno = ERANGE;
- return (-1);
+ return -1;
}
if (imsg->hdr.len > av)
- return (0);
+ return 0;
datalen = imsg->hdr.len - IMSG_HEADER_SIZE;
ibuf->r.rptr = ibuf->r.buf + IMSG_HEADER_SIZE;
if (datalen == 0)
imsg->data = NULL;
else if ((imsg->data = malloc(datalen)) == NULL)
- return (-1);
+ return -1;
if (imsg->hdr.flags & IMSGF_HASFD)
imsg->fd = imsg_get_fd(ibuf);
@@ -201,16 +201,16 @@ int imsg_compose(struct imsgbuf *ibuf, uint32_t type, uint32_t peerid,
struct ibuf *wbuf;
if ((wbuf = imsg_create(ibuf, type, peerid, pid, datalen)) == NULL)
- return (-1);
+ return -1;
if (imsg_add(wbuf, data, datalen) == -1)
- return (-1);
+ return -1;
wbuf->fd = fd;
imsg_close(ibuf, wbuf);
- return (1);
+ return 1;
}
int imsg_composev(struct imsgbuf *ibuf, uint32_t type, uint32_t peerid,
@@ -223,17 +223,17 @@ int imsg_composev(struct imsgbuf *ibuf, uint32_t type, uint32_t peerid,
datalen += iov[i].iov_len;
if ((wbuf = imsg_create(ibuf, type, peerid, pid, datalen)) == NULL)
- return (-1);
+ return -1;
for (i = 0; i < iovcnt; i++)
if (imsg_add(wbuf, iov[i].iov_base, iov[i].iov_len) == -1)
- return (-1);
+ return -1;
wbuf->fd = fd;
imsg_close(ibuf, wbuf);
- return (1);
+ return 1;
}
/* ARGSUSED */
@@ -248,7 +248,7 @@ struct ibuf *imsg_create(struct imsgbuf *ibuf, uint32_t type, uint32_t peerid,
datalen += IMSG_HEADER_SIZE;
if (datalen > MAX_IMSGSIZE) {
errno = ERANGE;
- return (NULL);
+ return NULL;
}
hdr.type = type;
@@ -257,10 +257,10 @@ struct ibuf *imsg_create(struct imsgbuf *ibuf, uint32_t type, uint32_t peerid,
if ((hdr.pid = pid) == 0)
hdr.pid = ibuf->pid;
if ((wbuf = ibuf_dynamic(datalen, MAX_IMSGSIZE)) == NULL) {
- return (NULL);
+ return NULL;
}
if (imsg_add(wbuf, &hdr, sizeof(hdr)) == -1)
- return (NULL);
+ return NULL;
return (wbuf);
}
@@ -270,7 +270,7 @@ int imsg_add(struct ibuf *msg, const void *data, uint16_t datalen)
if (datalen)
if (ibuf_add(msg, data, datalen) == -1) {
ibuf_free(msg);
- return (-1);
+ return -1;
}
return (datalen);
}
@@ -301,7 +301,7 @@ int imsg_get_fd(struct imsgbuf *ibuf)
struct imsg_fd *ifd;
if ((ifd = TAILQ_POP_FIRST(&ibuf->fds, entry)) == NULL)
- return (-1);
+ return -1;
fd = ifd->fd;
free(ifd);
@@ -313,8 +313,8 @@ int imsg_flush(struct imsgbuf *ibuf)
{
while (ibuf->w.queued)
if (msgbuf_write(&ibuf->w) <= 0)
- return (-1);
- return (0);
+ return -1;
+ return 0;
}
void imsg_clear(struct imsgbuf *ibuf)