Created
March 27, 2016 15:27
-
-
Save vincentbernat/dc61d8b035545dc24efd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/51d.c b/src/51d.c | |
index 212d9b899bb5..40c9d37a53a5 100644 | |
--- a/src/51d.c | |
+++ b/src/51d.c | |
@@ -493,7 +493,7 @@ void _51d_init_http_headers() | |
{ | |
int index = 0; | |
global._51degrees.header_count = fiftyoneDegreesGetHttpHeaderCount(); | |
- global._51degrees.device_offsets.firstOffset = (fiftyoneDegreesDeviceOffset*)malloc( | |
+ global._51degrees.device_offsets.firstOffset = malloc( | |
global._51degrees.header_count * sizeof(fiftyoneDegreesDeviceOffset)); | |
global._51degrees.header_names = malloc(global._51degrees.header_count * sizeof(struct chunk)); | |
global._51degrees.header_offsets = malloc(global._51degrees.header_count * sizeof(int32_t)); | |
diff --git a/src/acl.c b/src/acl.c | |
index 033cfc916bfd..0b88284efe83 100644 | |
--- a/src/acl.c | |
+++ b/src/acl.c | |
@@ -353,7 +353,7 @@ struct acl_expr *parse_acl_expr(const char **args, char **err, struct arg_list * | |
cur_type = smp_expr_output_type(smp); | |
} | |
- expr = (struct acl_expr *)calloc(1, sizeof(*expr)); | |
+ expr = calloc(1, sizeof(*expr)); | |
if (!expr) { | |
memprintf(err, "out of memory when parsing ACL expression"); | |
goto out_return; | |
@@ -749,7 +749,7 @@ struct acl *parse_acl(const char **args, struct list *known_acl, char **err, str | |
memprintf(err, "out of memory when parsing ACL"); | |
goto out_free_acl_expr; | |
} | |
- cur_acl = (struct acl *)calloc(1, sizeof(*cur_acl)); | |
+ cur_acl = calloc(1, sizeof(*cur_acl)); | |
if (cur_acl == NULL) { | |
memprintf(err, "out of memory when parsing ACL"); | |
goto out_free_name; | |
@@ -846,7 +846,7 @@ static struct acl *find_acl_default(const char *acl_name, struct list *known_acl | |
goto out_free_acl_expr; | |
} | |
- cur_acl = (struct acl *)calloc(1, sizeof(*cur_acl)); | |
+ cur_acl = calloc(1, sizeof(*cur_acl)); | |
if (cur_acl == NULL) { | |
memprintf(err, "out of memory when building default ACL '%s'", acl_name); | |
goto out_free_name; | |
@@ -907,7 +907,7 @@ struct acl_cond *parse_acl_cond(const char **args, struct list *known_acl, | |
struct acl_cond *cond; | |
unsigned int suite_val; | |
- cond = (struct acl_cond *)calloc(1, sizeof(*cond)); | |
+ cond = calloc(1, sizeof(*cond)); | |
if (cond == NULL) { | |
memprintf(err, "out of memory when parsing condition"); | |
goto out_return; | |
@@ -995,7 +995,7 @@ struct acl_cond *parse_acl_cond(const char **args, struct list *known_acl, | |
} | |
} | |
- cur_term = (struct acl_term *)calloc(1, sizeof(*cur_term)); | |
+ cur_term = calloc(1, sizeof(*cur_term)); | |
if (cur_term == NULL) { | |
memprintf(err, "out of memory when parsing condition"); | |
goto out_free_suite; | |
@@ -1017,7 +1017,7 @@ struct acl_cond *parse_acl_cond(const char **args, struct list *known_acl, | |
suite_val &= cur_acl->val; | |
if (!cur_suite) { | |
- cur_suite = (struct acl_term_suite *)calloc(1, sizeof(*cur_suite)); | |
+ cur_suite = calloc(1, sizeof(*cur_suite)); | |
if (cur_suite == NULL) { | |
memprintf(err, "out of memory when parsing condition"); | |
goto out_free_term; | |
diff --git a/src/cfgparse.c b/src/cfgparse.c | |
index 92f3611b4e68..75cd2174899d 100644 | |
--- a/src/cfgparse.c | |
+++ b/src/cfgparse.c | |
@@ -290,7 +290,7 @@ int str2listener(char *str, struct proxy *curproxy, struct bind_conf *bind_conf, | |
ss = *ss2; | |
for (; port <= end; port++) { | |
- l = (struct listener *)calloc(1, sizeof(struct listener)); | |
+ l = calloc(1, sizeof(struct listener)); | |
l->obj_type = OBJ_TYPE_LISTENER; | |
LIST_ADDQ(&curproxy->conf.listeners, &l->by_fe); | |
LIST_ADDQ(&bind_conf->listeners, &l->by_bind); | |
@@ -1411,7 +1411,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) | |
if (global.desc) | |
free(global.desc); | |
- global.desc = d = (char *)calloc(1, len); | |
+ global.desc = d = calloc(1, len); | |
d += snprintf(d, global.desc + len - d, "%s", args[1]); | |
for (i = 2; *args[i]; i++) | |
@@ -2119,7 +2119,7 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm) | |
} | |
} | |
- if ((curpeers = (struct peers *)calloc(1, sizeof(struct peers))) == NULL) { | |
+ if ((curpeers = calloc(1, sizeof(struct peers))) == NULL) { | |
Alert("parsing [%s:%d] : out of memory.\n", file, linenum); | |
err_code |= ERR_ALERT | ERR_ABORT; | |
goto out; | |
@@ -2153,7 +2153,7 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm) | |
goto out; | |
} | |
- if ((newpeer = (struct peer *)calloc(1, sizeof(struct peer))) == NULL) { | |
+ if ((newpeer = calloc(1, sizeof(struct peer))) == NULL) { | |
Alert("parsing [%s:%d] : out of memory.\n", file, linenum); | |
err_code |= ERR_ALERT | ERR_ABORT; | |
goto out; | |
@@ -2316,7 +2316,7 @@ int cfg_parse_resolvers(const char *file, int linenum, char **args, int kwm) | |
} | |
} | |
- if ((curr_resolvers = (struct dns_resolvers *)calloc(1, sizeof(struct dns_resolvers))) == NULL) { | |
+ if ((curr_resolvers = calloc(1, sizeof(struct dns_resolvers))) == NULL) { | |
Alert("parsing [%s:%d] : out of memory.\n", file, linenum); | |
err_code |= ERR_ALERT | ERR_ABORT; | |
goto out; | |
@@ -2364,7 +2364,7 @@ int cfg_parse_resolvers(const char *file, int linenum, char **args, int kwm) | |
} | |
} | |
- if ((newnameserver = (struct dns_nameserver *)calloc(1, sizeof(struct dns_nameserver))) == NULL) { | |
+ if ((newnameserver = calloc(1, sizeof(struct dns_nameserver))) == NULL) { | |
Alert("parsing [%s:%d] : out of memory.\n", file, linenum); | |
err_code |= ERR_ALERT | ERR_ABORT; | |
goto out; | |
@@ -2535,7 +2535,7 @@ int cfg_parse_mailers(const char *file, int linenum, char **args, int kwm) | |
} | |
} | |
- if ((curmailers = (struct mailers *)calloc(1, sizeof(struct mailers))) == NULL) { | |
+ if ((curmailers = calloc(1, sizeof(struct mailers))) == NULL) { | |
Alert("parsing [%s:%d] : out of memory.\n", file, linenum); | |
err_code |= ERR_ALERT | ERR_ABORT; | |
goto out; | |
@@ -2570,7 +2570,7 @@ int cfg_parse_mailers(const char *file, int linenum, char **args, int kwm) | |
goto out; | |
} | |
- if ((newmailer = (struct mailer *)calloc(1, sizeof(struct mailer))) == NULL) { | |
+ if ((newmailer = calloc(1, sizeof(struct mailer))) == NULL) { | |
Alert("parsing [%s:%d] : out of memory.\n", file, linenum); | |
err_code |= ERR_ALERT | ERR_ABORT; | |
goto out; | |
@@ -2725,7 +2725,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) | |
err_code |= ERR_ALERT | ERR_FATAL; | |
} | |
- if ((curproxy = (struct proxy *)calloc(1, sizeof(struct proxy))) == NULL) { | |
+ if ((curproxy = calloc(1, sizeof(struct proxy))) == NULL) { | |
Alert("parsing [%s:%d] : out of memory.\n", file, linenum); | |
err_code |= ERR_ALERT | ERR_ABORT; | |
goto out; | |
@@ -3173,7 +3173,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) | |
free(curproxy->monitor_uri); | |
curproxy->monitor_uri_len = strlen(args[1]); | |
- curproxy->monitor_uri = (char *)calloc(1, curproxy->monitor_uri_len + 1); | |
+ curproxy->monitor_uri = calloc(1, curproxy->monitor_uri_len + 1); | |
memcpy(curproxy->monitor_uri, args[1], curproxy->monitor_uri_len); | |
curproxy->monitor_uri[curproxy->monitor_uri_len] = '\0'; | |
@@ -3254,7 +3254,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) | |
for (i = 1; *args[i]; i++) | |
len += strlen(args[i]) + 1; | |
- d = (char *)calloc(1, len); | |
+ d = calloc(1, len); | |
curproxy->desc = d; | |
d += snprintf(d, curproxy->desc + len - d, "%s", args[1]); | |
@@ -3960,7 +3960,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) | |
err_code |= warnif_cond_conflicts(cond, SMP_VAL_FE_SET_BCK, file, linenum); | |
} | |
- rule = (struct switching_rule *)calloc(1, sizeof(*rule)); | |
+ rule = calloc(1, sizeof(*rule)); | |
rule->cond = cond; | |
rule->be.name = strdup(args[1]); | |
LIST_INIT(&rule->list); | |
@@ -4000,7 +4000,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) | |
err_code |= warnif_cond_conflicts(cond, SMP_VAL_BE_SET_SRV, file, linenum); | |
- rule = (struct server_rule *)calloc(1, sizeof(*rule)); | |
+ rule = calloc(1, sizeof(*rule)); | |
rule->cond = cond; | |
rule->srv.name = strdup(args[1]); | |
LIST_INIT(&rule->list); | |
@@ -4039,7 +4039,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) | |
*/ | |
err_code |= warnif_cond_conflicts(cond, SMP_VAL_BE_REQ_CNT, file, linenum); | |
- rule = (struct persist_rule *)calloc(1, sizeof(*rule)); | |
+ rule = calloc(1, sizeof(*rule)); | |
rule->cond = cond; | |
if (!strcmp(args[0], "force-persist")) { | |
rule->type = PERSIST_TYPE_FORCE; | |
@@ -4322,7 +4322,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) | |
else | |
err_code |= warnif_cond_conflicts(cond, SMP_VAL_BE_SET_SRV, file, linenum); | |
- rule = (struct sticking_rule *)calloc(1, sizeof(*rule)); | |
+ rule = calloc(1, sizeof(*rule)); | |
rule->cond = cond; | |
rule->expr = expr; | |
rule->flags = flags; | |
@@ -4371,7 +4371,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) | |
(curproxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR, | |
file, linenum); | |
- rule = (struct stats_admin_rule *)calloc(1, sizeof(*rule)); | |
+ rule = calloc(1, sizeof(*rule)); | |
rule->cond = cond; | |
LIST_INIT(&rule->list); | |
LIST_ADDQ(&curproxy->uri_auth->admin_rules, &rule->list); | |
@@ -4518,7 +4518,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) | |
for (i = 2; *args[i]; i++) | |
len += strlen(args[i]) + 1; | |
- desc = d = (char *)calloc(1, len); | |
+ desc = d = calloc(1, len); | |
d += snprintf(d, desc + len - d, "%s", args[2]); | |
for (i = 3; *args[i]; i++) | |
@@ -4803,7 +4803,7 @@ stats_error_parsing: | |
curproxy->check_len = strlen(DEF_CHECK_REQ); | |
} else if (!*args[3]) { /* one argument : URI */ | |
int reqlen = strlen(args[2]) + strlen("OPTIONS HTTP/1.0\r\n") + 1; | |
- curproxy->check_req = (char *)malloc(reqlen); | |
+ curproxy->check_req = malloc(reqlen); | |
curproxy->check_len = snprintf(curproxy->check_req, reqlen, | |
"OPTIONS %s HTTP/1.0\r\n", args[2]); /* URI to use */ | |
} else { /* more arguments : METHOD URI [HTTP_VER] */ | |
@@ -4813,7 +4813,7 @@ stats_error_parsing: | |
else | |
reqlen += strlen("HTTP/1.0"); | |
- curproxy->check_req = (char *)malloc(reqlen); | |
+ curproxy->check_req = malloc(reqlen); | |
curproxy->check_len = snprintf(curproxy->check_req, reqlen, | |
"%s %s %s\r\n", args[2], args[3], *args[4]?args[4]:"HTTP/1.0"); | |
} | |
@@ -4846,7 +4846,7 @@ stats_error_parsing: | |
} else { /* ESMTP EHLO, or SMTP HELO, and a hostname */ | |
if (!strcmp(args[2], "EHLO") || !strcmp(args[2], "HELO")) { | |
int reqlen = strlen(args[2]) + strlen(args[3]) + strlen(" \r\n") + 1; | |
- curproxy->check_req = (char *)malloc(reqlen); | |
+ curproxy->check_req = malloc(reqlen); | |
curproxy->check_len = snprintf(curproxy->check_req, reqlen, | |
"%s %s\r\n", args[2], args[3]); /* HELO hostname */ | |
} else { | |
@@ -4890,7 +4890,7 @@ stats_error_parsing: | |
packet_len = 4 + 4 + 5 + strlen(args[cur_arg + 1])+1 +1; | |
pv = htonl(0x30000); /* protocol version 3.0 */ | |
- packet = (char*) calloc(1, packet_len); | |
+ packet = calloc(1, packet_len); | |
memcpy(packet + 4, &pv, 4); | |
@@ -4930,7 +4930,7 @@ stats_error_parsing: | |
curproxy->options2 &= ~PR_O2_CHK_ANY; | |
curproxy->options2 |= PR_O2_REDIS_CHK; | |
- curproxy->check_req = (char *) malloc(sizeof(DEF_REDIS_CHECK_REQ) - 1); | |
+ curproxy->check_req = malloc(sizeof(DEF_REDIS_CHECK_REQ) - 1); | |
memcpy(curproxy->check_req, DEF_REDIS_CHECK_REQ, sizeof(DEF_REDIS_CHECK_REQ) - 1); | |
curproxy->check_len = sizeof(DEF_REDIS_CHECK_REQ) - 1; | |
@@ -5003,7 +5003,7 @@ stats_error_parsing: | |
reqlen = packetlen + 9; | |
free(curproxy->check_req); | |
- curproxy->check_req = (char *)calloc(1, reqlen); | |
+ curproxy->check_req = calloc(1, reqlen); | |
curproxy->check_len = reqlen; | |
snprintf(curproxy->check_req, 4, "%c%c%c", | |
@@ -5029,7 +5029,7 @@ stats_error_parsing: | |
reqlen = packetlen + 9; | |
free(curproxy->check_req); | |
- curproxy->check_req = (char *)calloc(1, reqlen); | |
+ curproxy->check_req = calloc(1, reqlen); | |
curproxy->check_len = reqlen; | |
snprintf(curproxy->check_req, 4, "%c%c%c", | |
@@ -5062,7 +5062,7 @@ stats_error_parsing: | |
curproxy->options2 &= ~PR_O2_CHK_ANY; | |
curproxy->options2 |= PR_O2_LDAP_CHK; | |
- curproxy->check_req = (char *) malloc(sizeof(DEF_LDAP_CHECK_REQ) - 1); | |
+ curproxy->check_req = malloc(sizeof(DEF_LDAP_CHECK_REQ) - 1); | |
memcpy(curproxy->check_req, DEF_LDAP_CHECK_REQ, sizeof(DEF_LDAP_CHECK_REQ) - 1); | |
curproxy->check_len = sizeof(DEF_LDAP_CHECK_REQ) - 1; | |
if (alertif_too_many_args_idx(0, 1, file, linenum, args, &err_code)) | |
@@ -5395,7 +5395,7 @@ stats_error_parsing: | |
struct tcpcheck_rule *tcpcheck; | |
cur_arg = 1; | |
- tcpcheck = (struct tcpcheck_rule *)calloc(1, sizeof(*tcpcheck)); | |
+ tcpcheck = calloc(1, sizeof(*tcpcheck)); | |
tcpcheck->action = TCPCHK_ACT_COMMENT; | |
if (!*args[cur_arg + 1]) { | |
@@ -5432,7 +5432,7 @@ stats_error_parsing: | |
} | |
cur_arg = 2; | |
- tcpcheck = (struct tcpcheck_rule *)calloc(1, sizeof(*tcpcheck)); | |
+ tcpcheck = calloc(1, sizeof(*tcpcheck)); | |
tcpcheck->action = TCPCHK_ACT_CONNECT; | |
/* parsing each parameters to fill up the rule */ | |
@@ -5497,7 +5497,7 @@ stats_error_parsing: | |
} else { | |
struct tcpcheck_rule *tcpcheck; | |
- tcpcheck = (struct tcpcheck_rule *)calloc(1, sizeof(*tcpcheck)); | |
+ tcpcheck = calloc(1, sizeof(*tcpcheck)); | |
tcpcheck->action = TCPCHK_ACT_SEND; | |
tcpcheck->string_len = strlen(args[2]); | |
@@ -5529,7 +5529,7 @@ stats_error_parsing: | |
struct tcpcheck_rule *tcpcheck; | |
char *err = NULL; | |
- tcpcheck = (struct tcpcheck_rule *)calloc(1, sizeof(*tcpcheck)); | |
+ tcpcheck = calloc(1, sizeof(*tcpcheck)); | |
tcpcheck->action = TCPCHK_ACT_SEND; | |
if (parse_binary(args[2], &tcpcheck->string, &tcpcheck->string_len, &err) == 0) { | |
@@ -5590,7 +5590,7 @@ stats_error_parsing: | |
goto out; | |
} | |
- tcpcheck = (struct tcpcheck_rule *)calloc(1, sizeof(*tcpcheck)); | |
+ tcpcheck = calloc(1, sizeof(*tcpcheck)); | |
tcpcheck->action = TCPCHK_ACT_EXPECT; | |
if (parse_binary(args[cur_arg + 1], &tcpcheck->string, &tcpcheck->string_len, &err) == 0) { | |
@@ -5626,7 +5626,7 @@ stats_error_parsing: | |
goto out; | |
} | |
- tcpcheck = (struct tcpcheck_rule *)calloc(1, sizeof(*tcpcheck)); | |
+ tcpcheck = calloc(1, sizeof(*tcpcheck)); | |
tcpcheck->action = TCPCHK_ACT_EXPECT; | |
tcpcheck->string_len = strlen(args[cur_arg + 1]); | |
@@ -5658,7 +5658,7 @@ stats_error_parsing: | |
goto out; | |
} | |
- tcpcheck = (struct tcpcheck_rule *)calloc(1, sizeof(*tcpcheck)); | |
+ tcpcheck = calloc(1, sizeof(*tcpcheck)); | |
tcpcheck->action = TCPCHK_ACT_EXPECT; | |
tcpcheck->string_len = 0; | |
@@ -6782,7 +6782,7 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm) | |
goto out; | |
} | |
- newul = (struct userlist *)calloc(1, sizeof(struct userlist)); | |
+ newul = calloc(1, sizeof(struct userlist)); | |
if (!newul) { | |
Alert("parsing [%s:%d]: out of memory.\n", file, linenum); | |
err_code |= ERR_ALERT | ERR_ABORT; | |
@@ -6883,7 +6883,7 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm) | |
goto out; | |
} | |
- newuser = (struct auth_users *)calloc(1, sizeof(struct auth_users)); | |
+ newuser = calloc(1, sizeof(struct auth_users)); | |
if (!newuser) { | |
Alert("parsing [%s:%d]: out of memory.\n", file, linenum); | |
err_code |= ERR_ALERT | ERR_ABORT; | |
@@ -8134,7 +8134,7 @@ out_uri_auth_compat: | |
if ((curproxy->options2 & PR_O2_CHK_ANY) == PR_O2_SSL3_CHK) { | |
curproxy->check_len = sizeof(sslv3_client_hello_pkt) - 1; | |
- curproxy->check_req = (char *)malloc(curproxy->check_len); | |
+ curproxy->check_req = malloc(curproxy->check_len); | |
memcpy(curproxy->check_req, sslv3_client_hello_pkt, curproxy->check_len); | |
} | |
@@ -8748,7 +8748,7 @@ out_uri_auth_compat: | |
/* enable separate counters */ | |
if (curproxy->options2 & PR_O2_SOCKSTAT) { | |
- listener->counters = (struct licounters *)calloc(1, sizeof(struct licounters)); | |
+ listener->counters = calloc(1, sizeof(struct licounters)); | |
if (!listener->name) | |
memprintf(&listener->name, "sock-%d", listener->luid); | |
} | |
diff --git a/src/dumpstats.c b/src/dumpstats.c | |
index 1bb5d8858e61..284b5be1f7ef 100644 | |
--- a/src/dumpstats.c | |
+++ b/src/dumpstats.c | |
@@ -567,7 +567,7 @@ static struct proxy *alloc_stats_fe(const char *name, const char *file, int line | |
{ | |
struct proxy *fe; | |
- fe = (struct proxy *)calloc(1, sizeof(struct proxy)); | |
+ fe = calloc(1, sizeof(struct proxy)); | |
if (!fe) | |
return NULL; | |
diff --git a/src/fd.c b/src/fd.c | |
index 2a6179f9fee5..aeee6026100f 100644 | |
--- a/src/fd.c | |
+++ b/src/fd.c | |
@@ -252,10 +252,10 @@ int init_pollers() | |
int p; | |
struct poller *bp; | |
- if ((fd_cache = (uint32_t *)calloc(1, sizeof(uint32_t) * global.maxsock)) == NULL) | |
+ if ((fd_cache = calloc(1, sizeof(uint32_t) * global.maxsock)) == NULL) | |
goto fail_cache; | |
- if ((fd_updt = (uint32_t *)calloc(1, sizeof(uint32_t) * global.maxsock)) == NULL) | |
+ if ((fd_updt = calloc(1, sizeof(uint32_t) * global.maxsock)) == NULL) | |
goto fail_updt; | |
do { | |
diff --git a/src/haproxy.c b/src/haproxy.c | |
index b10f4e86224e..3188e5a86f9f 100644 | |
--- a/src/haproxy.c | |
+++ b/src/haproxy.c | |
@@ -711,7 +711,7 @@ void init(int argc, char **argv) | |
/* now that's a cfgfile list */ | |
argv++; argc--; | |
while (argc > 0) { | |
- wl = (struct wordlist *)calloc(1, sizeof(*wl)); | |
+ wl = calloc(1, sizeof(*wl)); | |
if (!wl) { | |
Alert("Cannot load configuration file %s : out of memory.\n", *argv); | |
exit(1); | |
@@ -734,7 +734,7 @@ void init(int argc, char **argv) | |
case 'N' : cfg_maxpconn = atol(*argv); break; | |
case 'L' : strncpy(localpeer, *argv, sizeof(localpeer) - 1); break; | |
case 'f' : | |
- wl = (struct wordlist *)calloc(1, sizeof(*wl)); | |
+ wl = calloc(1, sizeof(*wl)); | |
if (!wl) { | |
Alert("Cannot load configuration file %s : out of memory.\n", *argv); | |
exit(1); | |
@@ -1101,13 +1101,13 @@ void init(int argc, char **argv) | |
if (global.nbproc < 1) | |
global.nbproc = 1; | |
- swap_buffer = (char *)calloc(1, global.tune.bufsize); | |
- get_http_auth_buff = (char *)calloc(1, global.tune.bufsize); | |
+ swap_buffer = calloc(1, global.tune.bufsize); | |
+ get_http_auth_buff = calloc(1, global.tune.bufsize); | |
static_table_key = calloc(1, sizeof(*static_table_key)); | |
- fdinfo = (struct fdinfo *)calloc(1, | |
+ fdinfo = calloc(1, | |
sizeof(struct fdinfo) * (global.maxsock)); | |
- fdtab = (struct fdtab *)calloc(1, | |
+ fdtab = calloc(1, | |
sizeof(struct fdtab) * (global.maxsock)); | |
/* | |
* Note: we could register external pollers here. | |
diff --git a/src/hlua.c b/src/hlua.c | |
index 54fbc48474a7..108c12c9b7f1 100644 | |
--- a/src/hlua.c | |
+++ b/src/hlua.c | |
@@ -2977,7 +2977,7 @@ __LJMP static int hlua_run_sample_fetch(lua_State *L) | |
struct sample smp; | |
/* Get closure arguments. */ | |
- f = (struct sample_fetch *)lua_touserdata(L, lua_upvalueindex(1)); | |
+ f = lua_touserdata(L, lua_upvalueindex(1)); | |
/* Get traditionnal arguments. */ | |
hsmp = MAY_LJMP(hlua_checkfetches(L, 1)); | |
@@ -3090,7 +3090,7 @@ __LJMP static int hlua_run_sample_conv(lua_State *L) | |
struct sample smp; | |
/* Get closure arguments. */ | |
- conv = (struct sample_conv *)lua_touserdata(L, lua_upvalueindex(1)); | |
+ conv = lua_touserdata(L, lua_upvalueindex(1)); | |
/* Get traditionnal arguments. */ | |
hsmp = MAY_LJMP(hlua_checkconverters(L, 1)); | |
diff --git a/src/lb_chash.c b/src/lb_chash.c | |
index ee1dc5232648..a62dfb5b2c4b 100644 | |
--- a/src/lb_chash.c | |
+++ b/src/lb_chash.c | |
@@ -391,7 +391,7 @@ void chash_init_server_tree(struct proxy *p) | |
srv->lb_tree = (srv->flags & SRV_F_BACKUP) ? &p->lbprm.chash.bck : &p->lbprm.chash.act; | |
srv->lb_nodes_tot = srv->uweight * BE_WEIGHT_SCALE; | |
srv->lb_nodes_now = 0; | |
- srv->lb_nodes = (struct tree_occ *)calloc(srv->lb_nodes_tot, sizeof(struct tree_occ)); | |
+ srv->lb_nodes = calloc(srv->lb_nodes_tot, sizeof(struct tree_occ)); | |
for (node = 0; node < srv->lb_nodes_tot; node++) { | |
srv->lb_nodes[node].server = srv; | |
diff --git a/src/lb_map.c b/src/lb_map.c | |
index be61b77e8c94..43d33c6f8b84 100644 | |
--- a/src/lb_map.c | |
+++ b/src/lb_map.c | |
@@ -191,7 +191,7 @@ void init_server_map(struct proxy *p) | |
if (!act) | |
act = 1; | |
- p->lbprm.map.srv = (struct server **)calloc(act, sizeof(struct server *)); | |
+ p->lbprm.map.srv = calloc(act, sizeof(struct server *)); | |
/* recounts servers and their weights */ | |
p->lbprm.map.state = LB_MAP_RECALC; | |
recount_servers(p); | |
diff --git a/src/namespace.c b/src/namespace.c | |
index 108c994f3dff..e9262e037fce 100644 | |
--- a/src/namespace.c | |
+++ b/src/namespace.c | |
@@ -67,7 +67,7 @@ struct netns_entry* netns_store_insert(const char *ns_name) | |
if (fd == -1) | |
goto out; | |
- entry = (struct netns_entry *)calloc(1, sizeof(struct netns_entry)); | |
+ entry = calloc(1, sizeof(struct netns_entry)); | |
if (!entry) | |
goto out; | |
entry->fd = fd; | |
diff --git a/src/peers.c b/src/peers.c | |
index d3fef4ae3f4b..e8dedf583841 100644 | |
--- a/src/peers.c | |
+++ b/src/peers.c | |
@@ -1975,7 +1975,7 @@ void peers_register_table(struct peers *peers, struct stktable *table) | |
int id = 0; | |
for (curpeer = peers->remote; curpeer; curpeer = curpeer->next) { | |
- st = (struct shared_table *)calloc(1,sizeof(struct shared_table)); | |
+ st = calloc(1,sizeof(struct shared_table)); | |
st->table = table; | |
st->next = curpeer->tables; | |
if (curpeer->tables) | |
diff --git a/src/proto_http.c b/src/proto_http.c | |
index b7654a67a565..4e861fcba00a 100644 | |
--- a/src/proto_http.c | |
+++ b/src/proto_http.c | |
@@ -8777,7 +8777,7 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li | |
int cur_arg; | |
char *error; | |
- rule = (struct act_rule*)calloc(1, sizeof(struct act_rule)); | |
+ rule = calloc(1, sizeof(struct act_rule)); | |
if (!rule) { | |
Alert("parsing [%s:%d]: out of memory.\n", file, linenum); | |
goto out_err; | |
@@ -9715,7 +9715,7 @@ struct redirect_rule *http_parse_redirect_rule(const char *file, int linenum, st | |
return NULL; | |
} | |
- rule = (struct redirect_rule *)calloc(1, sizeof(*rule)); | |
+ rule = calloc(1, sizeof(*rule)); | |
rule->cond = cond; | |
LIST_INIT(&rule->rdr_fmt); | |
diff --git a/src/server.c b/src/server.c | |
index 0405da28d00c..fcd3b4a8ad8e 100644 | |
--- a/src/server.c | |
+++ b/src/server.c | |
@@ -874,7 +874,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr | |
struct protocol *proto; | |
struct dns_resolution *curr_resolution; | |
- if ((newsrv = (struct server *)calloc(1, sizeof(struct server))) == NULL) { | |
+ if ((newsrv = calloc(1, sizeof(struct server))) == NULL) { | |
Alert("parsing [%s:%d] : out of memory.\n", file, linenum); | |
err_code |= ERR_ALERT | ERR_ABORT; | |
goto out; | |
diff --git a/src/standard.c b/src/standard.c | |
index 2fe92baecf2d..a4d20978a02e 100644 | |
--- a/src/standard.c | |
+++ b/src/standard.c | |
@@ -2068,7 +2068,7 @@ char *my_strndup(const char *src, int n) | |
while (len < n && src[len]) | |
len++; | |
- ret = (char *)malloc(len + 1); | |
+ ret = malloc(len + 1); | |
if (!ret) | |
return ret; | |
memcpy(ret, src, len); | |
diff --git a/src/uri_auth.c b/src/uri_auth.c | |
index 837b71256bb3..c03acbb66370 100644 | |
--- a/src/uri_auth.c | |
+++ b/src/uri_auth.c | |
@@ -28,7 +28,7 @@ struct uri_auth *stats_check_init_uri_auth(struct uri_auth **root) | |
struct uri_auth *u; | |
if (!root || !*root) { | |
- if ((u = (struct uri_auth *)calloc(1, sizeof (*u))) == NULL) | |
+ if ((u = calloc(1, sizeof (*u))) == NULL) | |
goto out_u; | |
LIST_INIT(&u->http_req_rules); | |
@@ -224,7 +224,7 @@ struct uri_auth *stats_add_auth(struct uri_auth **root, char *user) | |
return NULL; | |
if (!u->userlist) | |
- u->userlist = (struct userlist *)calloc(1, sizeof(struct userlist)); | |
+ u->userlist = calloc(1, sizeof(struct userlist)); | |
if (!u->userlist) | |
return NULL; | |
@@ -242,7 +242,7 @@ struct uri_auth *stats_add_auth(struct uri_auth **root, char *user) | |
return u; | |
} | |
- newuser = (struct auth_users *)calloc(1, sizeof(struct auth_users)); | |
+ newuser = calloc(1, sizeof(struct auth_users)); | |
if (!newuser) | |
return NULL; | |
@@ -291,7 +291,7 @@ struct uri_auth *stats_add_scope(struct uri_auth **root, char *scope) | |
if ((new_name = strdup(scope)) == NULL) | |
goto out_u; | |
- if ((old_scope = (struct stat_scope *)calloc(1, sizeof(*old_scope))) == NULL) | |
+ if ((old_scope = calloc(1, sizeof(*old_scope))) == NULL) | |
goto out_name; | |
old_scope->px_id = new_name; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment