diff options
| author | Donatas Abraitis <donatas.abraitis@gmail.com> | 2020-02-09 14:21:56 +0200 |
|---|---|---|
| committer | Donatas Abraitis <donatas.abraitis@gmail.com> | 2020-02-09 14:21:56 +0200 |
| commit | 95f7965d09a6eb4447c0de5a679114492cac3f37 (patch) | |
| tree | 1bfa78792b4f62934a483104e921f0bff5809590 /lib/imsg-buffer.c | |
| parent | 5f1032f291b8581d44570047f2d063bb6daea983 (diff) | |
*: Remove parenthesis on return for constants
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
Diffstat (limited to 'lib/imsg-buffer.c')
| -rw-r--r-- | lib/imsg-buffer.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/lib/imsg-buffer.c b/lib/imsg-buffer.c index c2f4052b8f..4d41702707 100644 --- a/lib/imsg-buffer.c +++ b/lib/imsg-buffer.c @@ -30,10 +30,10 @@ struct ibuf *ibuf_open(size_t len) struct ibuf *buf; if ((buf = calloc(1, sizeof(struct ibuf))) == NULL) - return (NULL); + return NULL; if ((buf->buf = malloc(len)) == NULL) { free(buf); - return (NULL); + return NULL; } buf->size = buf->max = len; buf->fd = -1; @@ -46,10 +46,10 @@ struct ibuf *ibuf_dynamic(size_t len, size_t max) struct ibuf *buf; if (max < len) - return (NULL); + return NULL; if ((buf = ibuf_open(len)) == NULL) - return (NULL); + return NULL; if (max > 0) buf->max = max; @@ -64,27 +64,27 @@ static int ibuf_realloc(struct ibuf *buf, size_t len) /* on static buffers max is eq size and so the following fails */ if (buf->wpos + len > buf->max) { errno = ERANGE; - return (-1); + return -1; } b = realloc(buf->buf, buf->wpos + len); if (b == NULL) - return (-1); + return -1; buf->buf = b; buf->size = buf->wpos + len; - return (0); + return 0; } int ibuf_add(struct ibuf *buf, const void *data, size_t len) { if (buf->wpos + len > buf->size) if (ibuf_realloc(buf, len) == -1) - return (-1); + return -1; memcpy(buf->buf + buf->wpos, data, len); buf->wpos += len; - return (0); + return 0; } void *ibuf_reserve(struct ibuf *buf, size_t len) @@ -93,7 +93,7 @@ void *ibuf_reserve(struct ibuf *buf, size_t len) if (buf->wpos + len > buf->size) if (ibuf_realloc(buf, len) == -1) - return (NULL); + return NULL; b = buf->buf + buf->wpos; buf->wpos += len; @@ -104,7 +104,7 @@ void *ibuf_seek(struct ibuf *buf, size_t pos, size_t len) { /* only allowed to seek in already written parts */ if (pos + len > buf->wpos) - return (NULL); + return NULL; return (buf->buf + pos); } @@ -146,17 +146,17 @@ again: goto again; if (errno == ENOBUFS) errno = EAGAIN; - return (-1); + return -1; } if (n == 0) { /* connection closed */ errno = 0; - return (0); + return 0; } msgbuf_drain(msgbuf, n); - return (1); + return 1; } void ibuf_free(struct ibuf *buf) @@ -246,12 +246,12 @@ again: goto again; if (errno == ENOBUFS) errno = EAGAIN; - return (-1); + return -1; } if (n == 0) { /* connection closed */ errno = 0; - return (0); + return 0; } /* @@ -265,7 +265,7 @@ again: msgbuf_drain(msgbuf, n); - return (1); + return 1; } static void ibuf_enqueue(struct msgbuf *msgbuf, struct ibuf *buf) |
