CLEANUP: remove unneeded casts

In C89, "void *" is automatically promoted to any pointer type. Casting
the result of malloc/calloc to the type of the LHS variable is therefore
unneeded.

Most of this patch was built using this Coccinelle patch:

@@
type T;
@@

- (T *)
  (\(lua_touserdata\|malloc\|calloc\|SSL_get_app_data\|hlua_checkudata\|lua_newuserdata\)(...))

@@
type T;
T *x;
void *data;
@@

  x =
- (T *)
  data

@@
type T;
T *x;
T *data;
@@

  x =
- (T *)
  data

Unfortunately, either Coccinelle or I is too limited to detect situation
where a complex RHS expression is of type "void *" and therefore casting
is not needed. Those cases were manually examined and corrected.
diff --git a/src/51d.c b/src/51d.c
index 212d9b8..f6e4979 100644
--- a/src/51d.c
+++ b/src/51d.c
@@ -179,7 +179,7 @@
  */
 static void _51d_retrieve_cache_entry(struct sample *smp, struct lru64 *lru)
 {
-	struct chunk *cache_entry = (struct chunk*)lru->data;
+	struct chunk *cache_entry = lru->data;
 	smp->data.u.str.str = cache_entry->str;
 	smp->data.u.str.len = cache_entry->len;
 }
@@ -493,7 +493,7 @@
 {
 	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 033cfc9..0b88284 100644
--- a/src/acl.c
+++ b/src/acl.c
@@ -353,7 +353,7 @@
 		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 @@
 			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 @@
 		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 *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 @@
 			}
 		}
 
-		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 @@
 		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 92f3611..2dba02a 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -290,7 +290,7 @@
 		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 @@
 		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 @@
 			}
 		}
 
-		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 @@
 			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;
@@ -2238,12 +2238,12 @@
 
 				list_for_each_entry(l, &bind_conf->listeners, by_bind) {
 					l->maxaccept = 1;
-					l->maxconn = ((struct proxy *)curpeers->peers_fe)->maxconn;
-					l->backlog = ((struct proxy *)curpeers->peers_fe)->backlog;
+					l->maxconn = curpeers->peers_fe->maxconn;
+					l->backlog = curpeers->peers_fe->backlog;
 					l->accept = session_accept_fd;
 					l->handler = process_stream;
-					l->analysers |=  ((struct proxy *)curpeers->peers_fe)->fe_req_ana;
-					l->default_target = ((struct proxy *)curpeers->peers_fe)->default_target;
+					l->analysers |=  curpeers->peers_fe->fe_req_ana;
+					l->default_target = curpeers->peers_fe->default_target;
 					l->options |= LI_O_UNLIMITED; /* don't make the peers subject to global limits */
 					global.maxsock += l->maxconn;
 				}
@@ -2316,7 +2316,7 @@
 			}
 		}
 
-		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 @@
 			}
 		}
 
-		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 @@
 			}
 		}
 
-		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 @@
 			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 @@
 				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 @@
 
 		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 @@
 		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 @@
 			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 @@
 
 		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 @@
 		 */
 		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 @@
 		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 @@
 			                                  (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 @@
 				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 @@
 				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 @@
 				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 @@
 			} 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 @@
 						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 @@
 			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 @@
 								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 @@
 							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 @@
 			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 @@
 			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 @@
 			}
 
 			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 @@
 			} 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 @@
 				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 @@
 					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 @@
 					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 @@
 					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 @@
 				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 @@
 				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 @@
 
 		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 @@
 
 			/* 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/dns.c b/src/dns.c
index c854744..14c3b6b 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -137,7 +137,7 @@
 		return;
 
 	/* no need to go further if we can't retrieve the nameserver */
-	if ((nameserver = (struct dns_nameserver *)dgram->owner) == NULL)
+	if ((nameserver = dgram->owner) == NULL)
 		return;
 
 	resolvers = nameserver->resolvers;
@@ -259,7 +259,7 @@
 	fd_stop_send(fd);
 
 	/* no need to go further if we can't retrieve the nameserver */
-	if ((nameserver = (struct dns_nameserver *)dgram->owner) == NULL)
+	if ((nameserver = dgram->owner) == NULL)
 		return;
 
 	resolvers = nameserver->resolvers;
diff --git a/src/dumpstats.c b/src/dumpstats.c
index 341fd56..7291af6 100644
--- a/src/dumpstats.c
+++ b/src/dumpstats.c
@@ -413,7 +413,7 @@
 {
 	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/ev_kqueue.c b/src/ev_kqueue.c
index 007336f..081e78a 100644
--- a/src/ev_kqueue.c
+++ b/src/ev_kqueue.c
@@ -155,7 +155,7 @@
 		goto fail_fd;
 
 	/* we can have up to two events per fd (*/
-	kev = (struct kevent*)calloc(1, sizeof(struct kevent) * 2 * global.maxsock);
+	kev = calloc(1, sizeof(struct kevent) * 2 * global.maxsock);
 	if (kev == NULL)
 		goto fail_kev;
 		
diff --git a/src/fd.c b/src/fd.c
index 2a6179f..aeee602 100644
--- a/src/fd.c
+++ b/src/fd.c
@@ -252,10 +252,10 @@
 	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 b10f4e8..51af55a 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -711,7 +711,7 @@
 				/* 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 @@
 				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,14 +1101,12 @@
 	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,
-				       sizeof(struct fdinfo) * (global.maxsock));
-	fdtab = (struct fdtab *)calloc(1,
-				       sizeof(struct fdtab) * (global.maxsock));
+	fdinfo = calloc(1, sizeof(struct fdinfo) * (global.maxsock));
+	fdtab = calloc(1, sizeof(struct fdtab) * (global.maxsock));
 	/*
 	 * Note: we could register external pollers here.
 	 * Built-in pollers have been registered before main().
diff --git a/src/hlua.c b/src/hlua.c
index 0f49125..4132ace 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -1374,7 +1374,7 @@
  */
 __LJMP static struct map_descriptor *hlua_checkmap(lua_State *L, int ud)
 {
-	return (struct map_descriptor *)MAY_LJMP(hlua_checkudata(L, ud, class_map_ref));
+	return MAY_LJMP(hlua_checkudata(L, ud, class_map_ref));
 }
 
 /* This function is the map constructor. It don't need
@@ -1516,7 +1516,7 @@
 
 __LJMP static struct hlua_socket *hlua_checksocket(lua_State *L, int ud)
 {
-	return (struct hlua_socket *)MAY_LJMP(hlua_checkudata(L, ud, class_socket_ref));
+	return MAY_LJMP(hlua_checkudata(L, ud, class_socket_ref));
 }
 
 /* This function is the handler called for each I/O on the established
@@ -2439,7 +2439,7 @@
  */
 __LJMP static struct channel *hlua_checkchannel(lua_State *L, int ud)
 {
-	return (struct channel *)MAY_LJMP(hlua_checkudata(L, ud, class_channel_ref));
+	return MAY_LJMP(hlua_checkudata(L, ud, class_channel_ref));
 }
 
 /* Pushes the channel onto the top of the stack. If the stask does not have a
@@ -2885,7 +2885,7 @@
  */
 __LJMP static struct hlua_smp *hlua_checkfetches(lua_State *L, int ud)
 {
-	return (struct hlua_smp *)MAY_LJMP(hlua_checkudata(L, ud, class_fetches_ref));
+	return MAY_LJMP(hlua_checkudata(L, ud, class_fetches_ref));
 }
 
 /* This function creates and push in the stack a fetch object according
@@ -2934,7 +2934,7 @@
 	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));
@@ -2998,7 +2998,7 @@
  */
 __LJMP static struct hlua_smp *hlua_checkconverters(lua_State *L, int ud)
 {
-	return (struct hlua_smp *)MAY_LJMP(hlua_checkudata(L, ud, class_converters_ref));
+	return MAY_LJMP(hlua_checkudata(L, ud, class_converters_ref));
 }
 
 /* This function creates and push in the stack a Converters object
@@ -3047,7 +3047,7 @@
 	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));
@@ -3119,7 +3119,7 @@
  */
 __LJMP static struct hlua_appctx *hlua_checkapplet_tcp(lua_State *L, int ud)
 {
-	return (struct hlua_appctx *)MAY_LJMP(hlua_checkudata(L, ud, class_applet_tcp_ref));
+	return MAY_LJMP(hlua_checkudata(L, ud, class_applet_tcp_ref));
 }
 
 /* This function creates and push in the stack an Applet object
@@ -3431,7 +3431,7 @@
  */
 __LJMP static struct hlua_appctx *hlua_checkapplet_http(lua_State *L, int ud)
 {
-	return (struct hlua_appctx *)MAY_LJMP(hlua_checkudata(L, ud, class_applet_http_ref));
+	return MAY_LJMP(hlua_checkudata(L, ud, class_applet_http_ref));
 }
 
 /* This function creates and push in the stack an Applet object
@@ -4099,7 +4099,7 @@
  */
 __LJMP static struct hlua_txn *hlua_checkhttp(lua_State *L, int ud)
 {
-	return (struct hlua_txn *)MAY_LJMP(hlua_checkudata(L, ud, class_http_ref));
+	return MAY_LJMP(hlua_checkudata(L, ud, class_http_ref));
 }
 
 /* This function creates and push in the stack a HTTP object
@@ -4503,7 +4503,7 @@
  */
 __LJMP static struct hlua_txn *hlua_checktxn(lua_State *L, int ud)
 {
-	return (struct hlua_txn *)MAY_LJMP(hlua_checkudata(L, ud, class_txn_ref));
+	return MAY_LJMP(hlua_checkudata(L, ud, class_txn_ref));
 }
 
 __LJMP static int hlua_set_var(lua_State *L)
@@ -5114,7 +5114,7 @@
  */
 static int hlua_sample_conv_wrapper(const struct arg *arg_p, struct sample *smp, void *private)
 {
-	struct hlua_function *fcn = (struct hlua_function *)private;
+	struct hlua_function *fcn = private;
 	struct stream *stream = smp->strm;
 	const char *error;
 
@@ -5222,7 +5222,7 @@
 static int hlua_sample_fetch_wrapper(const struct arg *arg_p, struct sample *smp,
                                      const char *kw, void *private)
 {
-	struct hlua_function *fcn = (struct hlua_function *)private;
+	struct hlua_function *fcn = private;
 	struct stream *stream = smp->strm;
 	const char *error;
 
@@ -6053,7 +6053,7 @@
 static enum act_parse_ret action_register_lua(const char **args, int *cur_arg, struct proxy *px,
                                               struct act_rule *rule, char **err)
 {
-	struct hlua_function *fcn = (struct hlua_function *)rule->kw->private;
+	struct hlua_function *fcn = rule->kw->private;
 
 	/* Memory for the rule. */
 	rule->arg.hlua_rule = calloc(1, sizeof(*rule->arg.hlua_rule));
@@ -6076,7 +6076,7 @@
 static enum act_parse_ret action_register_service_http(const char **args, int *cur_arg, struct proxy *px,
                                                        struct act_rule *rule, char **err)
 {
-	struct hlua_function *fcn = (struct hlua_function *)rule->kw->private;
+	struct hlua_function *fcn = rule->kw->private;
 
 	/* HTTP applets are forbidden in tcp-request rules.
 	 * HTTP applet request requires everything initilized by
@@ -6196,7 +6196,7 @@
 static enum act_parse_ret action_register_service_tcp(const char **args, int *cur_arg, struct proxy *px,
                                                       struct act_rule *rule, char **err)
 {
-	struct hlua_function *fcn = (struct hlua_function *)rule->kw->private;
+	struct hlua_function *fcn = rule->kw->private;
 
 	/* Memory for the rule. */
 	rule->arg.hlua_rule = calloc(1, sizeof(*rule->arg.hlua_rule));
diff --git a/src/hlua_fcn.c b/src/hlua_fcn.c
index 2ee3393..b9ce84c 100644
--- a/src/hlua_fcn.c
+++ b/src/hlua_fcn.c
@@ -321,7 +321,7 @@
 
 static struct hlua_concat *hlua_check_concat(lua_State *L, int ud)
 {
-	return (struct hlua_concat *)(hlua_checkudata(L, ud, class_concat_ref));
+	return (hlua_checkudata(L, ud, class_concat_ref));
 }
 
 static int hlua_concat_add(lua_State *L)
@@ -390,7 +390,7 @@
 	struct hlua_concat *b;
 
 	lua_newtable(L);
-	b = (struct hlua_concat *)lua_newuserdata(L, sizeof(*b));
+	b = lua_newuserdata(L, sizeof(*b));
 	b->size = HLUA_CONCAT_BLOCSZ;
 	b->len = 0;
 	lua_rawseti(L, -2, 0);
@@ -451,7 +451,7 @@
 
 static struct listener *hlua_check_listener(lua_State *L, int ud)
 {
-	return (struct listener *)(hlua_checkudata(L, ud, class_listener_ref));
+	return hlua_checkudata(L, ud, class_listener_ref);
 }
 
 int hlua_listener_get_stats(lua_State *L)
@@ -493,7 +493,7 @@
 
 static struct server *hlua_check_server(lua_State *L, int ud)
 {
-	return (struct server *)(hlua_checkudata(L, ud, class_server_ref));
+	return hlua_checkudata(L, ud, class_server_ref);
 }
 
 int hlua_server_get_stats(lua_State *L)
@@ -801,7 +801,7 @@
 
 static struct proxy *hlua_check_proxy(lua_State *L, int ud)
 {
-	return (struct proxy *)(hlua_checkudata(L, ud, class_proxy_ref));
+	return hlua_checkudata(L, ud, class_proxy_ref);
 }
 
 int hlua_proxy_pause(lua_State *L)
diff --git a/src/lb_chash.c b/src/lb_chash.c
index ee1dc52..a62dfb5 100644
--- a/src/lb_chash.c
+++ b/src/lb_chash.c
@@ -391,7 +391,7 @@
 		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 be61b77..43d33c6 100644
--- a/src/lb_map.c
+++ b/src/lb_map.c
@@ -191,7 +191,7 @@
 	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 108c994..e9262e0 100644
--- a/src/namespace.c
+++ b/src/namespace.c
@@ -67,7 +67,7 @@
 	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 d3fef4a..56256fa 100644
--- a/src/peers.c
+++ b/src/peers.c
@@ -447,8 +447,8 @@
 {
 	struct stream_interface *si = appctx->owner;
 	struct stream *s = si_strm(si);
-	struct peer *peer = (struct peer *)appctx->ctx.peers.ptr;
-	struct peers *peers = (struct peers *)strm_fe(s)->parent;
+	struct peer *peer = appctx->ctx.peers.ptr;
+	struct peers *peers = strm_fe(s)->parent;
 
 	/* appctx->ctx.peers.ptr is not a peer session */
 	if (appctx->st0 < PEER_SESS_ST_SENDSUCCESS)
@@ -485,7 +485,7 @@
 {
 	struct stream_interface *si = appctx->owner;
 	struct stream *s = si_strm(si);
-	struct peers *curpeers = (struct peers *)strm_fe(s)->parent;
+	struct peers *curpeers = strm_fe(s)->parent;
 	int reql = 0;
 	int repl = 0;
 
@@ -615,7 +615,7 @@
 				/* fall through */
 			}
 			case PEER_SESS_ST_SENDSUCCESS: {
-				struct peer *curpeer = (struct peer *)appctx->ctx.peers.ptr;
+				struct peer *curpeer = appctx->ctx.peers.ptr;
 				struct shared_table *st;
 
 				repl = snprintf(trash.str, trash.size, "%d\n", PEER_SESS_SC_SUCCESSCODE);
@@ -670,7 +670,7 @@
 				goto switchstate;
 			}
 			case PEER_SESS_ST_CONNECT: {
-				struct peer *curpeer = (struct peer *)appctx->ctx.peers.ptr;
+				struct peer *curpeer = appctx->ctx.peers.ptr;
 
 				/* Send headers */
 				repl = snprintf(trash.str, trash.size,
@@ -698,7 +698,7 @@
 				/* fall through */
 			}
 			case PEER_SESS_ST_GETSTATUS: {
-				struct peer *curpeer = (struct peer *)appctx->ctx.peers.ptr;
+				struct peer *curpeer = appctx->ctx.peers.ptr;
 				struct shared_table *st;
 
 				if (si_ic(si)->flags & CF_WRITE_PARTIAL)
@@ -770,7 +770,7 @@
 				/* fall through */
 			}
 			case PEER_SESS_ST_WAITMSG: {
-				struct peer *curpeer = (struct peer *)appctx->ctx.peers.ptr;
+				struct peer *curpeer = appctx->ctx.peers.ptr;
 				struct stksess *ts, *newts = NULL;
 				uint32_t msg_len = 0;
 				char *msg_cur = trash.str;
@@ -1626,7 +1626,7 @@
 	if (!appctx)
 		return;
 
-	ps = (struct peer *)appctx->ctx.peers.ptr;
+	ps = appctx->ctx.peers.ptr;
 	/* we're killing a connection, we must apply a random delay before
 	 * retrying otherwise the other end will do the same and we can loop
 	 * for a while.
@@ -1661,7 +1661,7 @@
 static struct stream *peer_session_create(struct peers *peers, struct peer *peer)
 {
 	struct listener *l = LIST_NEXT(&peers->peers_fe->conf.listeners, struct listener *, by_fe);
-	struct proxy *p = (struct proxy *)l->frontend; /* attached frontend */
+	struct proxy *p = l->frontend; /* attached frontend */
 	struct appctx *appctx;
 	struct session *sess;
 	struct stream *s;
@@ -1755,7 +1755,7 @@
  */
 static struct task *process_peer_sync(struct task * task)
 {
-	struct peers *peers = (struct peers *)task->context;
+	struct peers *peers = task->context;
 	struct peer *ps;
 	struct shared_table *st;
 
@@ -1975,7 +1975,7 @@
 	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 0b20011..dc3fed5 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -8785,7 +8785,7 @@
 	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;
@@ -9723,7 +9723,7 @@
 		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 0405da2..d511a2a 100644
--- a/src/server.c
+++ b/src/server.c
@@ -874,7 +874,7 @@
 			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;
@@ -2667,7 +2667,7 @@
 	serverip = NULL;	/* current server IP address */
 
 	/* shortcut to the server whose name is being resolved */
-	s = (struct server *)resolution->requester;
+	s = resolution->requester;
 
 	/* initializing server IP pointer */
 	server_sin_family = s->addr.ss_family;
@@ -2775,7 +2775,7 @@
 	int res_preferred_afinet, res_preferred_afinet6;
 
 	/* shortcut to the server whose name is being resolved */
-	s = (struct server *)resolution->requester;
+	s = resolution->requester;
 	resolvers = resolution->resolvers;
 
 	/* can be ignored if this is not the last response */
diff --git a/src/shctx.c b/src/shctx.c
index a22730a..c561632 100644
--- a/src/shctx.c
+++ b/src/shctx.c
@@ -624,7 +624,7 @@
 	cur = &shctx->free;
 	for (i = 0 ; i < size ; i++) {
 		prev = cur;
-		cur = (struct shared_block *)((char *)prev + sizeof(struct shared_block));
+		cur++;
 		prev->n = cur;
 		cur->p = prev;
 	}
diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index 994cdcc..7b09c8e 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -474,7 +474,7 @@
 	int head;
 	int i;
 
-	conn = (struct connection *)SSL_get_app_data(s);
+	conn = SSL_get_app_data(s);
 	keys = objt_listener(conn->target)->bind_conf->keys_ref->tlskeys;
 	head = objt_listener(conn->target)->bind_conf->keys_ref->tls_ticket_enc_index;
 
@@ -615,7 +615,7 @@
 	int key_type;
 	int index;
 
-	ocsp_arg = (struct ocsp_cbk_arg *)arg;
+	ocsp_arg = arg;
 
 	ssl_pkey = SSL_get_privatekey(ssl);
 	if (!ssl_pkey)
@@ -767,7 +767,7 @@
 		 * If the ctx has a status CB, then we have previously set an OCSP staple for this ctx
 		 * Update that cb_arg with the new cert's staple
 		 */
-		struct ocsp_cbk_arg *cb_arg = (struct ocsp_cbk_arg *) ctx->tlsext_status_arg;
+		struct ocsp_cbk_arg *cb_arg = ctx->tlsext_status_arg;
 		struct certificate_ocsp *tmp_ocsp;
 		int index;
 
@@ -913,7 +913,7 @@
 
 int ssl_sock_sctl_add_cbk(SSL *ssl, unsigned ext_type, const unsigned char **out, size_t *outlen, int *al, void *add_arg)
 {
-	struct chunk *sctl = (struct chunk *)add_arg;
+	struct chunk *sctl = add_arg;
 
 	*out = (unsigned char *)sctl->str;
 	*outlen = sctl->len;
@@ -958,7 +958,7 @@
 
 void ssl_sock_infocbk(const SSL *ssl, int where, int ret)
 {
-	struct connection *conn = (struct connection *)SSL_get_app_data(ssl);
+	struct connection *conn = SSL_get_app_data(ssl);
 	BIO *write_bio;
 	(void)ret; /* shut gcc stupid warning */
 
@@ -996,7 +996,7 @@
 	int err, depth;
 
 	ssl = X509_STORE_CTX_get_ex_data(x_store, SSL_get_ex_data_X509_STORE_CTX_idx());
-	conn = (struct connection *)SSL_get_app_data(ssl);
+	conn = SSL_get_app_data(ssl);
 
 	conn->xprt_st |= SSL_SOCK_ST_FL_VERIFY_DONE;
 
@@ -1042,7 +1042,7 @@
 	/* test heartbeat received (write_p is set to 0
 	   for a received record) */
 	if ((content_type == TLS1_RT_HEARTBEAT) && (write_p == 0)) {
-		struct connection *conn = (struct connection *)SSL_get_app_data(ssl);
+		struct connection *conn = SSL_get_app_data(ssl);
 		const unsigned char *p = buf;
 		unsigned int payload;
 
@@ -1345,7 +1345,7 @@
 	servername = SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name);
 	if (!servername) {
 		if (s->generate_certs) {
-			struct connection *conn = (struct connection *)SSL_get_app_data(ssl);
+			struct connection *conn = SSL_get_app_data(ssl);
 			unsigned int key;
 			SSL_CTX *ctx;
 
@@ -2848,7 +2848,7 @@
 		return ok;
 
 	ssl = X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx());
-	conn = (struct connection *)SSL_get_app_data(ssl);
+	conn = SSL_get_app_data(ssl);
 
 	servername = objt_server(conn->target)->ssl_ctx.verify_host;
 
diff --git a/src/standard.c b/src/standard.c
index 2fe92ba..a4d2097 100644
--- a/src/standard.c
+++ b/src/standard.c
@@ -2068,7 +2068,7 @@
 	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/stick_table.c b/src/stick_table.c
index e5bb168..0d15490 100644
--- a/src/stick_table.c
+++ b/src/stick_table.c
@@ -383,7 +383,7 @@
  */
 static struct task *process_table_expire(struct task *task)
 {
-	struct stktable *t = (struct stktable *)task->context;
+	struct stktable *t = task->context;
 
 	task->expire = stktable_trash_expired(t);
 	return task;
diff --git a/src/uri_auth.c b/src/uri_auth.c
index 837b712..c03acbb 100644
--- a/src/uri_auth.c
+++ b/src/uri_auth.c
@@ -28,7 +28,7 @@
 	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 @@
 		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 @@
 			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 @@
 		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;
diff --git a/src/xxhash.c b/src/xxhash.c
index 3454691..5702e64 100644
--- a/src/xxhash.c
+++ b/src/xxhash.c
@@ -253,7 +253,7 @@
 //****************************
 FORCE_INLINE U32 XXH32_endian_align(const void* input, size_t len, U32 seed, XXH_endianess endian, XXH_alignment align)
 {
-    const BYTE* p = (const BYTE*)input;
+    const BYTE* p = input;
     const BYTE* bEnd = p + len;
     U32 h32;
 #define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
@@ -358,7 +358,7 @@
 
 FORCE_INLINE U64 XXH64_endian_align(const void* input, size_t len, U64 seed, XXH_endianess endian, XXH_alignment align)
 {
-    const BYTE* p = (const BYTE*)input;
+    const BYTE* p = input;
     const BYTE* bEnd = p + len;
     U64 h64;
 #define XXH_get64bits(p) XXH_readLE64_align(p, endian, align)
@@ -581,7 +581,7 @@
 FORCE_INLINE XXH_errorcode XXH32_update_endian (XXH32_state_t* state_in, const void* input, size_t len, XXH_endianess endian)
 {
     XXH_istate32_t* state = (XXH_istate32_t *) state_in;
-    const BYTE* p = (const BYTE*)input;
+    const BYTE* p = input;
     const BYTE* const bEnd = p + len;
 
 #ifdef XXH_ACCEPT_NULL_INPUT_POINTER
@@ -735,7 +735,7 @@
 FORCE_INLINE XXH_errorcode XXH64_update_endian (XXH64_state_t* state_in, const void* input, size_t len, XXH_endianess endian)
 {
     XXH_istate64_t * state = (XXH_istate64_t *) state_in;
-    const BYTE* p = (const BYTE*)input;
+    const BYTE* p = input;
     const BYTE* const bEnd = p + len;
 
 #ifdef XXH_ACCEPT_NULL_INPUT_POINTER