]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: Remove useless malloc() casts
authorTim Duesterhus <tim@bastelstu.be>
Thu, 8 Apr 2021 18:05:23 +0000 (20:05 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 8 Apr 2021 18:11:58 +0000 (20:11 +0200)
This is not C++.

include/haproxy/chunk.h
include/haproxy/listener.h
src/ev_select.c
src/http_htx.c

index b5052d135b2343d07a0dd556c87dafc032b3e811..af9ef816bba80d8ded02f30a81c141ce0f07e797 100644 (file)
@@ -283,7 +283,7 @@ static inline char *chunk_dup(struct buffer *dst, const struct buffer *src)
        if (dst->size < src->size || !src->size)
                dst->size++;
 
-       dst->area = (char *)malloc(dst->size);
+       dst->area = malloc(dst->size);
        if (!dst->area) {
                dst->head = 0;
                dst->data = 0;
index e4cea50fc6a5f0d6bd957f09cf65ec999506ec55..17fe9e09087f6dde89d726829c798c920ab08419 100644 (file)
@@ -179,7 +179,7 @@ unsigned int bind_map_thread_id(const struct bind_conf *conf, unsigned int r);
 static inline struct bind_conf *bind_conf_alloc(struct proxy *fe, const char *file,
                                  int line, const char *arg, struct xprt_ops *xprt)
 {
-       struct bind_conf *bind_conf = (void *)calloc(1, sizeof(struct bind_conf));
+       struct bind_conf *bind_conf = calloc(1, sizeof(struct bind_conf));
 
        bind_conf->file = strdup(file);
        bind_conf->line = line;
index 1e9c48cf5d378565b18d02e0c0ad535fbf76d97b..ab5da35b7c776befcaf8117015f4bc31b294f467 100644 (file)
@@ -226,10 +226,10 @@ static int init_select_per_thread()
        int fd_set_bytes;
 
        fd_set_bytes = sizeof(fd_set) * (global.maxsock + FD_SETSIZE - 1) / FD_SETSIZE;
-       tmp_evts[DIR_RD] = (fd_set *)calloc(1, fd_set_bytes);
+       tmp_evts[DIR_RD] = calloc(1, fd_set_bytes);
        if (tmp_evts[DIR_RD] == NULL)
                goto fail;
-       tmp_evts[DIR_WR] = (fd_set *)calloc(1, fd_set_bytes);
+       tmp_evts[DIR_WR] = calloc(1, fd_set_bytes);
        if (tmp_evts[DIR_WR] == NULL)
                goto fail;
        return 1;
index a7951c01d97f6754999f2107c766fd25fd5f35b6..53732d1466d7dad9557353c30c839bf4cd0fac9b 100644 (file)
@@ -909,7 +909,7 @@ int http_str_to_htx(struct buffer *buf, struct ist raw, char **errmsg)
        }
 
        buf->size = global.tune.bufsize;
-       buf->area = (char *)malloc(buf->size);
+       buf->area = malloc(buf->size);
        if (!buf->area)
                goto error;