Quantcast
Channel: Serverphorums.com - HAProxy
Viewing all 5112 articles
Browse latest View live

Re:LED Tri Proof Light (no replies)

$
0
0
Hello! Howareyou? ThisiswestonformLEDMASUSlimited,NowourhotsellingLED=TriProofLight,Thishavethebestpriceandquality,productwarran=ty:3years. Ifyouhaveinterestpleasecontactus. Thankyou.

Enhanced Wireless Module of DMX512. (no replies)

$
0
0
Dear Manager,Sandy from TOPP Technology. Wehaveluanchedanew = XLR DMX wireless receiver/transmitter(2000KMcomm=unicationdistance),whichcanreplacetheLCDDMXWilrelesssR/Ttota=lly.Below arethe&n=bsp;advantages over the previous versionandother=productsinChinamarket:1. 16 ID groups se=ttable vs 7 groups in previous version2. Communicaton distance: 2000meters3. S=oved almost all problems in customer's p=revious feedback, such as the receiver s=ometimes shine in hopping frequency.4. = New style and very stable in quali=ty, it will be more welcomed in the= market. Anyquestionsorinquiries=,pleasefeelfreetocontactus.Best Regards, Sandy Sales Executive T. +86&nbsp=;755 33564980 F. +86 27781054 M.&=nbsp;+15019488671 Email: info@topplights.com Skype: topplights ADD.: TOPP Technology&nb=sp;Limited 45-201, Fengtian industrial centre,&nbs=p;District of Bao'An ,Shenzhen, Guangdong, P.=R.C,China Web.: www.topplights.com

Increased CPU usage after upgrading 1.5.15 to 1.5.16 (5 replies)

$
0
0
Hello,
it seems I've stumbled upon a regression in haproxy 1.5.16.

Short story: After upgrading 1.5.15 to 1.5.16 CPU usage increased
significantly (3-4 times)

Long story:

I have several haproxy servers running happily with 1.5.15 for quite
some time. Recently I've started upgrading them to 1.5.16.
Unfortunately, as soon as I start 1.5.16 the CPU usage increases 3-4
times. Some haproxy processes eat 100% CPU (I run with nbproc=4).
Apart from that... everything works just fine and I've not noticed any
problems.
I also have a standby server. I've tried simulating some traffic but I
was unable to reproduce the problem there. As soon as I direct
production traffic to the standby server it shows the same behavior
(increased CPU as compared to 1.5.15).

System is running on Debian Jessie with kernel 4.3.3 from backports
and hand compiled OpenSSL 1.0.2g. Haproxy is acting mostly as a HTTP
load balancer with SSL. There are also some plain TCP backend, but
with negligible traffic.

"Bad" haproxy:
HA-Proxy version 1.5.16 2016/03/14
Copyright 2000-2016 Willy Tarreau <willy@haproxy.org>

Build options :
TARGET = linux2628
CPU = generic
CC = gcc
CFLAGS = -g -O2 -fstack-protector-strong -Wformat
-Werror=format-security -D_FORTIFY_SOURCE=2
OPTIONS = USE_ZLIB=1 USE_OPENSSL=1 USE_PCRE=1 USE_PCRE_JIT=1 USE_TFO=1

Default settings :
maxconn = 2000, bufsize = 16384, maxrewrite = 8192, maxpollevents = 200

Encrypted password support via crypt(3): yes
Built with zlib version : 1.2.8
Compression algorithms supported : identity, deflate, gzip
Built with OpenSSL version : OpenSSL 1.0.2g 1 Mar 2016
Running on OpenSSL version : OpenSSL 1.0.2g 1 Mar 2016
OpenSSL library supports TLS extensions : yes
OpenSSL library supports SNI : yes
OpenSSL library supports prefer-server-ciphers : yes
Built with PCRE version : 8.35 2014-04-04
PCRE library supports JIT : yes
Built with transparent proxy support using: IP_TRANSPARENT
IPV6_TRANSPARENT IP_FREEBIND

Available polling systems :
epoll : pref=300, test result OK
poll : pref=200, test result OK
select : pref=150, test result OK
Total: 3 (3 usable), will use epoll.

"Good" haproxy:
HA-Proxy version 1.5.15 2015/11/01
Copyright 2000-2015 Willy Tarreau <willy@haproxy.org>

Build options :
TARGET = linux2628
CPU = generic
CC = gcc
CFLAGS = -g -O2 -fstack-protector-strong -Wformat
-Werror=format-security -D_FORTIFY_SOURCE=2
OPTIONS = USE_ZLIB=1 USE_OPENSSL=1 USE_PCRE=1 USE_PCRE_JIT=1 USE_TFO=1

Default settings :
maxconn = 2000, bufsize = 16384, maxrewrite = 8192, maxpollevents = 200

Encrypted password support via crypt(3): yes
Built with zlib version : 1.2.8
Compression algorithms supported : identity, deflate, gzip
Built with OpenSSL version : OpenSSL 1.0.2g 1 Mar 2016
Running on OpenSSL version : OpenSSL 1.0.2g 1 Mar 2016
OpenSSL library supports TLS extensions : yes
OpenSSL library supports SNI : yes
OpenSSL library supports prefer-server-ciphers : yes
Built with PCRE version : 8.35 2014-04-04
PCRE library supports JIT : yes
Built with transparent proxy support using: IP_TRANSPARENT
IPV6_TRANSPARENT IP_FREEBIND

Available polling systems :
epoll : pref=300, test result OK
poll : pref=200, test result OK
select : pref=150, test result OK
Total: 3 (3 usable), will use epoll.

I have also Certificate Transparency patch applied, backported from 1.6.

I've also captured 10000 strace line from each haproxy (I had to use
-s0 to hide any user data though) if it helps in any way. The only
suspicious thing I see with 1.5.16 are large (>50) number of
consecutive calls to epoll_wait. Is this normal?

I'm out of ideas how to debug this problem, so any suggestions are welcome.

--
Janusz Dziemidowicz

[SPAM] 成本预算 (no replies)

map_dom vs map_str (no replies)

$
0
0
Hi all,

just read in the documentation that map_str uses a balanced tree vs.
map_dom is using a list. So why should I use map_dom? Right now I am
using following:

use_backend
%[req.hdr(host),lower,map_dom(/etc/haproxy/hostname2backend.map,default
_backend)] 

Would map_str improve the performance?

Thanks Gerd

High quality popular bags (no replies)

$
0
0
Hello ,my friend,


How are you ? This is Candy from Guanzhou Shera bag factory.
Let me tell you some good news ,please see the att. some popular bags.
We are the factory and we have dozens of new styles on every week. We also welcome your designs to make the OEM for you.
Could you please let me know if you will come to the Canton Fair on April ,2016?
We are warm welcome you to have a factory tourist .
We are look forward to hearing from you.


--

Thanks and Best Regards
Candy
Sales Manager
Guangzhou Shera-Bag Factory
Phone: 86-20-34329687
Tel: 86-13825029557
Email: candy@sherabag.com
Web: http://www.sherabag.com
Add: Rom1705 West Tower, Building C, Poly World Trade Center, No.1000 Xingandong Road, Haizhu District Guangzhou China.

ssl offloading (1 reply)

$
0
0
Hi list,

what are your ideas about offloading of ssl? ssl inside haproxy is nice
but is very expensive. So I would like to offload the ssl to something
else. 

Any ideas?

Thanks,

Gerd

[SPAM] 下调五险一金为企业减负,对员工有何影响...? (no replies)

$
0
0
附件供您参考


---------------- 原始邮件 ------------------
发件人: wo@rtours.com
发送时间: 2016年2016-4-2 星期一 15:56:56
收件人: haproxy@formilux.org
抄送: 章经理
主题: 答复: 回复:下调五险一金为企业减负,对员工有何影响...?

peers synchronization doesn't work on 1.6 (no replies)

$
0
0
Hello,
I have Haproxy 1.5 in production with peers which synchronize properly.
I have been testing version 1.6, but can't get peers to synchronize.
As a template for my lab I used example from the official documentation
(https://cbonte.github.io/haproxy-dconv/configuration-1.6.html#3.5-peer).

- Haproxy version: 1.6.4-3ppa1~trusty
- Iptables are turned off and nmap shows all used ports opened.

- Servers in lab:
haproxy1: 10.0.3.188
haproxy2: 10.0.3.186
worker1: 10.0.3.187:80
worker2: 10.0.3.187:81

- Haproxy configuration on both haproxy nodes:
global
daemon
group haproxy
log 127.0.0.1 local2 debug
maxconn 5000
stats socket /var/run/haproxy.sock mode 666 level user
stats socket /var/run/haproxy_admin.sock mode 600 level admin
user haproxy

defaults
log global
option dontlognull
retries 4
balance roundrobin
timeout connect 5s
timeout client 5s
timeout server 5s

peers mypeers
peer haproxy1 10.0.3.188:1024
peer haproxy2 10.0.3.186:1024

frontend www
bind 0.0.0.0:80
mode tcp
default_backend mybackend

backend mybackend
mode tcp
balance roundrobin
stick-table type ip size 20k peers mypeers
stick on src
server worker1 10.0.3.187:80 check
server worker2 10.0.3.187:81 check


- Workers return their names:
$ curl http://10.0.3.187:80
worker1
$ curl http://10.0.3.187:81
worker2

- Test workflow:
After start stick-table on both nodes is empty as expected:
root@haproxy1:~# echo show table mybackend |socat
unix-connect:/var/run/haproxy_admin.sock stdio
# table: mybackend, type: ip, size:20480, used:0

root@haproxy2:~# echo show table mybackend |socat
unix-connect:/var/run/haproxy_admin.sock stdio
# table: mybackend, type: ip, size:20480, used:0

- Curling haproxy1 creates record in the stick-table on the haproxy1,
but this record has never been replicated to the haproxy2
$ curl http://10.0.3.188
worker1

root@haproxy1:~# echo show table mybackend |socat
unix-connect:/var/run/haproxy_admin.sock stdio
# table: mybackend, type: ip, size:20480, used:1
0x55e6bbe08fb4: key=10.0.0.215 use=0 exp=0 server_id=1

root@haproxy2:~# echo show table mybackend |socat
unix-connect:/var/run/haproxy_admin.sock stdio
# table: mybackend, type: ip, size:20480, used:0

I've tested this configuration with 1.5 and synchronization works like a
charm.

Thanks,
Marko

Q: about HTTP/2 (7 replies)

$
0
0
Hi Willy & other core devs/pms.

I know that HTTP/2 is on the road-map but not ready yet.

Would you be so kind and share some of your thoughts, stats and plans
for HTTP/2.

Thank you very much.

Best regards
Aleks

[PATCH] BUG/MINOR: dumpstats: fix write to global chunk (1 reply)

$
0
0
Hi,

there is a small bug in dumpstats.c, stats_dump_fields_csv(). One of the
writes is to the global `trash` chunk, which happens to be the right one,
but it should be to what gets passed in as argument (out).

Not even sure this was worth a patch, but it is attached if you like.
Otherwise, feel free to just fix by hand :)

Happy weekend,
Conrad
--
Conrad Hoffmann
Traffic Engineer

SoundCloud Ltd. | Rheinsberger Str. 76/77, 10115 Berlin, Germany

Managing Director: Alexander Ljung | Incorporated in England & Wales
with Company No. 6343600 | Local Branch Office | AG Charlottenburg |
HRB 110657B

[PATCH] DOC: fix "needed" typo (1 reply)

$
0
0
While at it use "You" instead of "They" as in the context
it seems to make more sense to refer to "you", as it is
you that are going to be running the command, there is no
"they".

Signed-off-by: Thiago Farina <tfarina@chromium.org>
---
CONTRIBUTING | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/CONTRIBUTING b/CONTRIBUTING
index 0f6b9ed..968da4f 100644
--- a/CONTRIBUTING
+++ b/CONTRIBUTING
@@ -626,14 +626,14 @@ formating or style issue :
$ git show master..

And once you're satisfied, you should update your master branch to be sure that
-nothing changed during your work (only neede if you left it unattended for days
+nothing changed during your work (only needed if you left it unattended for days
or weeks) :

$ git checkout -b 20150920-fix-stats-rebased
$ git fetch origin master:master
$ git rebase master

-They can build a list of patches ready for submission like this :
+You can build a list of patches ready for submission like this :

$ git format-patch master

--
1.7.9.5

FW:Smart Balance Wheel Hoverboard (no replies)

$
0
0
HiDearDoyouwanttohavealookatthisyear'smostfashionableelectronic=products?=20www.hoverboard361.comLookingforwardyourvisit!BestregardsSteven

KA-BOOM! Hit MaxConn despite higher setting in config file (6 replies)

$
0
0
So in my config file I have:

maxconn 65535
fullconn 64511

However, "show info" still has a maxconn 2000 limit and that caused a blow
up because I exceeded the limit =(

So my questions are 1) is there a way to raise maxconn without restarting
haproxy with the -P parameter (can I add -P when I do a reload?) 2) Are
there any other related gotchas I need to take care of?

I notice that ulimit-n and maxsock both show 4495 despite "ulimit -n" for
the user showing 65536 (which is probably half of what I really want since
each "session" is going to consume two sockets)

I'm using haproxy 1.5.12

cigar humidor,cigar accessories,jewelry box,chess box-sk539065 (no replies)

$
0
0
one of the biggest cigar accessories exporter in china
above 300 items have stock goods,can ship out within 7 days after order confirm
professional and quick service for distributor
do OEM or ODM for big importer
top quality humidor :with 3mm thickness hinge,piano super thick lacquer, solid wood frame
middle quality humidor: service many big importer, above 100000pcs 1 year
the cataloge please download the following link:
http://www.allwaygroup.com/sikarlan2015.pdf
Additional 2016 new product and details, please contact us.



Regards,

DENIS
ALLWAY GROUP LTD
2/F ,Block A5 ,NanYan 3 street 422-472# ,
NanZhou N.RD,HaiZhu District,GuangZhou City,
GuangDong Province,China
TEL:86-20-84042816 FAX:86-20-84041636 MOBILE:13922457369
allwaygroup@188.com

if you not want to receive our promotion letter again, just send remove to the address: remove@allwaygroup.com we will remove your email from our mailing list








113.66.113.251 - Manual Import
39065
...

[PATCH 2/2] CLEANUP: uniformize last argument of malloc/calloc (no replies)

$
0
0
From: Vincent Bernat <vincent@bernat.im>

Instead of repeating the type of the LHS argument (sizeof(struct ...))
in calls to malloc/calloc, we directly use the pointer
name (sizeof(*...)). The following Coccinelle patch was used:

@@
type T;
T *x;
@@

x = malloc(
- sizeof(T)
+ sizeof(*x)
)

@@
type T;
T *x;
@@

x = calloc(1,
- sizeof(T)
+ sizeof(*x)
)

When the LHS is not just a variable name, no change is made. Moreover,
the following patch was used to ensure that "1" is consistently used as
a first argument of calloc, not the last one:

@@
@@

calloc(
+ 1,
...
- ,1
)
---
src/51d.c | 4 ++--
src/acl.c | 4 ++--
src/cfgparse.c | 32 ++++++++++++++++----------------
src/compression.c | 4 ++--
src/dns.c | 2 +-
src/dumpstats.c | 2 +-
src/flt_http_comp.c | 2 +-
src/log.c | 10 +++++-----
src/namespace.c | 2 +-
src/peers.c | 2 +-
src/proto_http.c | 4 ++--
src/proto_tcp.c | 2 +-
src/proxy.c | 2 +-
src/regex.c | 2 +-
src/sample.c | 4 ++--
src/server.c | 4 ++--
src/ssl_sock.c | 8 ++++----
src/uri_auth.c | 2 +-
18 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/src/51d.c b/src/51d.c
index f6e497999f80..3aa5b860b2f5 100644
--- a/src/51d.c
+++ b/src/51d.c
@@ -54,7 +54,7 @@ static int _51d_property_name_list(char **args, int section_type, struct proxy *
}

while (*(args[cur_arg])) {
- name = calloc(1, sizeof(struct _51d_property_names));
+ name = calloc(1, sizeof(*name));
name->name = strdup(args[cur_arg]);
LIST_ADDQ(&global._51degrees.property_names, &name->list);
++cur_arg;
@@ -158,7 +158,7 @@ static void *_51d_malloc(int size)
*/
static void _51d_insert_cache_entry(struct sample *smp, struct lru64 *lru, void* domain)
{
- struct chunk *cache_entry = _51d_malloc(sizeof(struct chunk));
+ struct chunk *cache_entry = _51d_malloc(sizeof(*cache_entry));

if (!cache_entry)
return;
diff --git a/src/acl.c b/src/acl.c
index 0b88284efe83..b275a246a3e4 100644
--- a/src/acl.c
+++ b/src/acl.c
@@ -176,7 +176,7 @@ struct acl_expr *parse_acl_expr(const char **args, char **err, struct arg_list *
/* OK we have a real ACL keyword */

/* build new sample expression for this ACL */
- smp = calloc(1, sizeof(struct sample_expr));
+ smp = calloc(1, sizeof(*smp));
if (!smp) {
memprintf(err, "out of memory when parsing ACL expression");
goto out_return;
@@ -298,7 +298,7 @@ struct acl_expr *parse_acl_expr(const char **args, char **err, struct arg_list *
}

cur_type = conv->out_type;
- conv_expr = calloc(1, sizeof(struct sample_conv_expr));
+ conv_expr = calloc(1, sizeof(*conv_expr));
if (!conv_expr)
goto out_free_smp;

diff --git a/src/cfgparse.c b/src/cfgparse.c
index 2dba02aa296c..abe2fe8660bb 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 = calloc(1, sizeof(struct listener));
+ l = calloc(1, sizeof(*l));
l->obj_type = OBJ_TYPE_LISTENER;
LIST_ADDQ(&curproxy->conf.listeners, &l->by_fe);
LIST_ADDQ(&bind_conf->listeners, &l->by_bind);
@@ -1571,7 +1571,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
goto out;
}

- logsrv = calloc(1, sizeof(struct logsrv));
+ logsrv = calloc(1, sizeof(*logsrv));

/* just after the address, a length may be specified */
if (strcmp(args[arg+2], "len") == 0) {
@@ -2119,7 +2119,7 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm)
}
}

- if ((curpeers = calloc(1, sizeof(struct peers))) == NULL) {
+ if ((curpeers = calloc(1, sizeof(*curpeers))) == 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 = calloc(1, sizeof(struct peer))) == NULL) {
+ if ((newpeer = calloc(1, sizeof(*newpeer))) == 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 = calloc(1, sizeof(struct dns_resolvers))) == NULL) {
+ if ((curr_resolvers = calloc(1, sizeof(*curr_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 = calloc(1, sizeof(struct dns_nameserver))) == NULL) {
+ if ((newnameserver = calloc(1, sizeof(*newnameserver))) == 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 = calloc(1, sizeof(struct mailers))) == NULL) {
+ if ((curmailers = calloc(1, sizeof(*curmailers))) == 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 = calloc(1, sizeof(struct mailer))) == NULL) {
+ if ((newmailer = calloc(1, sizeof(*newmailer))) == 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 = calloc(1, sizeof(struct proxy))) == NULL) {
+ if ((curproxy = calloc(1, sizeof(*curproxy))) == NULL) {
Alert("parsing [%s:%d] : out of memory.\n", file, linenum);
err_code |= ERR_ALERT | ERR_ABORT;
goto out;
@@ -2911,7 +2911,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)

/* copy default logsrvs to curproxy */
list_for_each_entry(tmplogsrv, &defproxy.logsrvs, list) {
- struct logsrv *node = malloc(sizeof(struct logsrv));
+ struct logsrv *node = malloc(sizeof(*node));
memcpy(node, tmplogsrv, sizeof(struct logsrv));
LIST_INIT(&node->list);
LIST_ADDQ(&curproxy->logsrvs, &node->list);
@@ -3739,7 +3739,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
goto out;
}

- hdr = calloc(sizeof(struct cap_hdr), 1);
+ hdr = calloc(1, sizeof(*hdr));
hdr->next = curproxy->req_cap;
hdr->name = strdup(args[3]);
hdr->namelen = strlen(args[3]);
@@ -3767,7 +3767,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
err_code |= ERR_ALERT | ERR_FATAL;
goto out;
}
- hdr = calloc(sizeof(struct cap_hdr), 1);
+ hdr = calloc(1, sizeof(*hdr));
hdr->next = curproxy->rsp_cap;
hdr->name = strdup(args[3]);
hdr->namelen = strlen(args[3]);
@@ -6043,7 +6043,7 @@ stats_error_parsing:
if (*(args[1]) && *(args[2]) == 0 && !strcmp(args[1], "global")) {
/* copy global.logrsvs linked list to the end of curproxy->logsrvs */
list_for_each_entry(tmplogsrv, &global.logsrvs, list) {
- struct logsrv *node = malloc(sizeof(struct logsrv));
+ struct logsrv *node = malloc(sizeof(*node));
memcpy(node, tmplogsrv, sizeof(struct logsrv));
LIST_INIT(&node->list);
LIST_ADDQ(&curproxy->logsrvs, &node->list);
@@ -6055,7 +6055,7 @@ stats_error_parsing:
int arg = 0;
int len = 0;

- logsrv = calloc(1, sizeof(struct logsrv));
+ logsrv = calloc(1, sizeof(*logsrv));

/* just after the address, a length may be specified */
if (strcmp(args[arg+2], "len") == 0) {
@@ -6782,7 +6782,7 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm)
goto out;
}

- newul = calloc(1, sizeof(struct userlist));
+ newul = calloc(1, sizeof(*newul));
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 = calloc(1, sizeof(struct auth_users));
+ newuser = calloc(1, sizeof(*newuser));
if (!newuser) {
Alert("parsing [%s:%d]: out of memory.\n", file, linenum);
err_code |= ERR_ALERT | ERR_ABORT;
diff --git a/src/compression.c b/src/compression.c
index 7b5a93915f9c..8d095855f193 100644
--- a/src/compression.c
+++ b/src/compression.c
@@ -109,7 +109,7 @@ int comp_append_type(struct comp *comp, const char *type)
{
struct comp_type *comp_type;

- comp_type = calloc(1, sizeof(struct comp_type));
+ comp_type = calloc(1, sizeof(*comp_type));
comp_type->name_len = strlen(type);
comp_type->name = strdup(type);
comp_type->next = comp->types;
@@ -127,7 +127,7 @@ int comp_append_algo(struct comp *comp, const char *algo)

for (i = 0; comp_algos.cfg_name; i++) {
if (!strcmp(algo, comp_algos.cfg_name)) {
- comp_algo = calloc(1, sizeof(struct comp_algo));
+ comp_algo = calloc(1, sizeof(*comp_algo));
memmove(comp_algo, &comp_algos, sizeof(struct comp_algo));
comp_algo->next = comp->algos;
comp->algos = comp_algo;
diff --git a/src/dns.c b/src/dns.c
index 14c3b6b61682..1ce786dc5bab 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -909,7 +909,7 @@ int dns_init_resolvers(void)
curr_resolvers->t = t;

list_for_each_entry(curnameserver, &curr_resolvers->nameserver_list, list) {
- if ((dgram = calloc(1, sizeof(struct dgram_conn))) == NULL) {
+ if ((dgram = calloc(1, sizeof(*dgram))) == NULL) {
Alert("Starting [%s/%s] nameserver: out of memory.\n", curr_resolvers->id,
curnameserver->id);
return 0;
diff --git a/src/dumpstats.c b/src/dumpstats.c
index 7291af690fdb..7e2a1d2958a0 100644
--- a/src/dumpstats.c
+++ b/src/dumpstats.c
@@ -413,7 +413,7 @@ static struct proxy *alloc_stats_fe(const char *name, const char *file, int line
{
struct proxy *fe;

- fe = calloc(1, sizeof(struct proxy));
+ fe = calloc(1, sizeof(*fe));
if (!fe)
return NULL;

diff --git a/src/flt_http_comp.c b/src/flt_http_comp.c
index 6bbf6a1a14bd..ee8f13bf15a8 100644
--- a/src/flt_http_comp.c
+++ b/src/flt_http_comp.c
@@ -772,7 +772,7 @@ parse_compression_options(char **args, int section, struct proxy *proxy,
struct comp *comp;

if (proxy->comp == NULL) {
- comp = calloc(1, sizeof(struct comp));
+ comp = calloc(1, sizeof(*comp));
proxy->comp = comp;
}
else
diff --git a/src/log.c b/src/log.c
index 4d496cdc0dca..47a4317e2e61 100644
--- a/src/log.c
+++ b/src/log.c
@@ -339,7 +339,7 @@ int parse_logformat_var(char *arg, int arg_len, char *var, int var_len, struct p
if (strlen(logformat_keywords[j].name) == var_len &&
strncmp(var, logformat_keywords[j].name, var_len) == 0) {
if (logformat_keywords[j].mode != PR_MODE_HTTP || curproxy->mode == PR_MODE_HTTP) {
- node = calloc(1, sizeof(struct logformat_node));
+ node = calloc(1, sizeof(*node));
node->type = logformat_keywords[j].type;
node->options = *defoptions;
if (arg_len) {
@@ -396,15 +396,15 @@ void add_to_logformat_list(char *start, char *end, int type, struct list *list_f
char *str;

if (type == LF_TEXT) { /* type text */
- struct logformat_node *node = calloc(1, sizeof(struct logformat_node));
- str = calloc(end - start + 1, 1);
+ struct logformat_node *node = calloc(1, sizeof(*node));
+ str = calloc(1, end - start + 1);
strncpy(str, start, end - start);
str[end - start] = '\0';
node->arg = str;
node->type = LOG_FMT_TEXT; // type string
LIST_ADDQ(list_format, &node->list);
} else if (type == LF_SEPARATOR) {
- struct logformat_node *node = calloc(1, sizeof(struct logformat_node));
+ struct logformat_node *node = calloc(1, sizeof(*node));
node->type = LOG_FMT_SEPARATOR;
LIST_ADDQ(list_format, &node->list);
}
@@ -435,7 +435,7 @@ void add_sample_to_logformat_list(char *text, char *arg, int arg_len, struct pro
return;
}

- node = calloc(1, sizeof(struct logformat_node));
+ node = calloc(1, sizeof(*node));
node->type = LOG_FMT_EXPR;
node->expr = expr;
node->options = options;
diff --git a/src/namespace.c b/src/namespace.c
index e9262e037fce..e5ebfd77672f 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 = calloc(1, sizeof(struct netns_entry));
+ entry = calloc(1, sizeof(*entry));
if (!entry)
goto out;
entry->fd = fd;
diff --git a/src/peers.c b/src/peers.c
index 56256fad1f7c..bf22b9344292 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 = calloc(1,sizeof(struct shared_table));
+ st = calloc(1,sizeof(*st));
st->table = table;
st->next = curpeer->tables;
if (curpeer->tables)
diff --git a/src/proto_http.c b/src/proto_http.c
index dc3fed51c741..74cd260c34af 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -8785,7 +8785,7 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
int cur_arg;
char *error;

- rule = calloc(1, sizeof(struct act_rule));
+ rule = calloc(1, sizeof(*rule));
if (!rule) {
Alert("parsing [%s:%d]: out of memory.\n", file, linenum);
goto out_err;
@@ -12421,7 +12421,7 @@ enum act_parse_ret parse_http_req_capture(const char **args, int *orig_arg, stru
return ACT_RET_PRS_ERR;
}

- hdr = calloc(sizeof(struct cap_hdr), 1);
+ hdr = calloc(1, sizeof(*hdr));
hdr->next = px->req_cap;
hdr->name = NULL; /* not a header capture */
hdr->namelen = 0;
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index cce0acbfae2a..a44912af4654 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -1641,7 +1641,7 @@ static int tcp_parse_request_rule(char **args, int arg, int section_type,
return -1;
}

- hdr = calloc(sizeof(struct cap_hdr), 1);
+ hdr = calloc(1, sizeof(*hdr));
hdr->next = curpx->req_cap;
hdr->name = NULL; /* not a header capture */
hdr->namelen = 0;
diff --git a/src/proxy.c b/src/proxy.c
index 5fb5b931710e..b90773fa4eae 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -415,7 +415,7 @@ static int proxy_parse_declare(char **args, int section, struct proxy *curpx,
}

/* register the capture. */
- hdr = calloc(1, sizeof(struct cap_hdr));
+ hdr = calloc(1, sizeof(*hdr));
hdr->name = NULL; /* not a header capture */
hdr->namelen = 0;
hdr->len = len;
diff --git a/src/regex.c b/src/regex.c
index c83e48268f0a..be4fe5b24596 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -139,7 +139,7 @@ const char *chain_regex(struct hdr_exp **head, struct my_regex *preg,
while (*head != NULL)
head = &(*head)->next;

- exp = calloc(1, sizeof(struct hdr_exp));
+ exp = calloc(1, sizeof(*exp));

exp->preg = preg;
exp->replace = replace;
diff --git a/src/sample.c b/src/sample.c
index fc4261064982..8a2fa4f3c6db 100644
--- a/src/sample.c
+++ b/src/sample.c
@@ -855,7 +855,7 @@ struct sample_expr *sample_parse_expr(char **str, int *idx, const char *file, in
}
prev_type = fetch->out_type;

- expr = calloc(1, sizeof(struct sample_expr));
+ expr = calloc(1, sizeof(*expr));
if (!expr)
goto out_error;

@@ -958,7 +958,7 @@ struct sample_expr *sample_parse_expr(char **str, int *idx, const char *file, in
}

prev_type = conv->out_type;
- conv_expr = calloc(1, sizeof(struct sample_conv_expr));
+ conv_expr = calloc(1, sizeof(*conv_expr));
if (!conv_expr)
goto out_error;

diff --git a/src/server.c b/src/server.c
index d511a2aba22b..72799bb541b6 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 = calloc(1, sizeof(struct server))) == NULL) {
+ if ((newsrv = calloc(1, sizeof(*newsrv))) == NULL) {
Alert("parsing [%s:%d] : out of memory.\n", file, linenum);
err_code |= ERR_ALERT | ERR_ABORT;
goto out;
@@ -945,7 +945,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
goto skip_name_resolution;

fqdn = NULL;
- if ((curr_resolution = calloc(1, sizeof(struct dns_resolution))) == NULL)
+ if ((curr_resolution = calloc(1, sizeof(*curr_resolution))) == NULL)
goto skip_name_resolution;

curr_resolution->hostname_dn_len = dns_str_to_dn_label_len(newsrv->hostname);
diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index 7b09c8e14758..8e577abd95ac 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -742,7 +742,7 @@ static int ssl_sock_load_ocsp(SSL_CTX *ctx, const char *cert_path)
if (!i || (i > OCSP_MAX_CERTID_ASN1_LENGTH))
goto out;

- ocsp = calloc(1, sizeof(struct certificate_ocsp));
+ ocsp = calloc(1, sizeof(*ocsp));
if (!ocsp)
goto out;

@@ -754,7 +754,7 @@ static int ssl_sock_load_ocsp(SSL_CTX *ctx, const char *cert_path)
ocsp = NULL;

if (!ctx->tlsext_status_cb) {
- struct ocsp_cbk_arg *cb_arg = calloc(1, sizeof(struct ocsp_cbk_arg));
+ struct ocsp_cbk_arg *cb_arg = calloc(1, sizeof(*cb_arg));

cb_arg->is_single = 1;
cb_arg->s_ocsp = iocsp;
@@ -897,7 +897,7 @@ static int ssl_sock_load_sctl_from_file(const char *sctl_path, struct chunk **sc
if (ret)
goto end;

- *sctl = calloc(1, sizeof(struct chunk));
+ *sctl = calloc(1, sizeof(**sctl));
if (!chunk_dup(*sctl, &trash)) {
free(*sctl);
*sctl = NULL;
@@ -5369,7 +5369,7 @@ static int bind_parse_tls_ticket_keys(char **args, int cur_arg, struct proxy *px
return 0;
}

- keys_ref = malloc(sizeof(struct tls_keys_ref));
+ keys_ref = malloc(sizeof(*keys_ref));
keys_ref->tlskeys = malloc(TLS_TICKETS_NO * sizeof(struct tls_sess_key));

if ((f = fopen(args[cur_arg + 1], "r")) == NULL) {
diff --git a/src/uri_auth.c b/src/uri_auth.c
index c03acbb66370..cfe1f4c10d9c 100644
--- a/src/uri_auth.c
+++ b/src/uri_auth.c
@@ -242,7 +242,7 @@ struct uri_auth *stats_add_auth(struct uri_auth **root, char *user)
return u;
}

- newuser = calloc(1, sizeof(struct auth_users));
+ newuser = calloc(1, sizeof(*newuser));
if (!newuser)
return NULL;

--
2.8.0.rc3

[PATCH 1/2] CLEANUP: remove unneeded casts (no replies)

$
0
0
From: Vincent Bernat <vincent@bernat.im>

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.
---
src/51d.c | 4 +--
src/acl.c | 12 ++++-----
src/cfgparse.c | 80 +++++++++++++++++++++++++++----------------------------
src/dns.c | 4 +--
src/dumpstats.c | 2 +-
src/ev_kqueue.c | 2 +-
src/fd.c | 4 +--
src/haproxy.c | 14 +++++-----
src/hlua.c | 32 +++++++++++-----------
src/hlua_fcn.c | 10 +++----
src/lb_chash.c | 2 +-
src/lb_map.c | 2 +-
src/namespace.c | 2 +-
src/peers.c | 22 +++++++--------
src/proto_http.c | 4 +--
src/server.c | 6 ++---
src/shctx.c | 2 +-
src/ssl_sock.c | 18 ++++++-------
src/standard.c | 2 +-
src/stick_table.c | 2 +-
src/uri_auth.c | 8 +++---
src/xxhash.c | 8 +++---
tests/filltab25.c | 2 +-
23 files changed, 121 insertions(+), 123 deletions(-)

diff --git a/src/51d.c b/src/51d.c
index 212d9b899bb5..f6e497999f80 100644
--- a/src/51d.c
+++ b/src/51d.c
@@ -179,7 +179,7 @@ static void _51d_insert_cache_entry(struct sample *smp, struct lru64 *lru, void*
*/
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 @@ 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..2dba02aa296c 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++)
@@ -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;
@@ -2238,12 +2238,12 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm)

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 @@ 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++)
len += strlen(args) + 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++)
len += strlen(args) + 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++)
@@ -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/dns.c b/src/dns.c
index c854744df08f..14c3b6b61682 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -137,7 +137,7 @@ void dns_resolve_recv(struct dgram_conn *dgram)
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 @@ void dns_resolve_send(struct dgram_conn *dgram)
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 341fd56e9156..7291af690fdb 100644
--- a/src/dumpstats.c
+++ b/src/dumpstats.c
@@ -413,7 +413,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/ev_kqueue.c b/src/ev_kqueue.c
index 007336fa7c19..081e78aa7757 100644
--- a/src/ev_kqueue.c
+++ b/src/ev_kqueue.c
@@ -155,7 +155,7 @@ REGPRM1 static int _do_init(struct poller *p)
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 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..51af55abcd50 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,14 +1101,12 @@ 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,
- 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 0f491255baf8..4132ace7dab2 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -1374,7 +1374,7 @@ static int hlua_set_map(lua_State *L)
*/
__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 int hlua_map_slookup(struct lua_State *L)

__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 @@ static int hlua_check_proto(struct stream *stream, int dir)
*/
__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 int hlua_channel_get_out_len(lua_State *L)
*/
__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 @@ __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));
@@ -2998,7 +2998,7 @@ __LJMP static int hlua_run_sample_fetch(lua_State *L)
*/
__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 @@ __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));
@@ -3119,7 +3119,7 @@ __LJMP static int hlua_run_sample_conv(lua_State *L)
*/
__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 int hlua_applet_tcp_send(lua_State *L)
*/
__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 int hlua_applet_http_start_response(lua_State *L)
*/
__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 @@ static int hlua_http_res_set_status(lua_State *L)
*/
__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_register_task(lua_State *L)
*/
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_conv_wrapper(const struct arg *arg_p, struct sample *smp,
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 void hlua_applet_http_release(struct appctx *ctx)
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_lua(const char **args, int *cur_arg, s
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 @@ __LJMP static int hlua_register_action(lua_State *L)
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 2ee3393559fa..b9ce84cde7c0 100644
--- a/src/hlua_fcn.c
+++ b/src/hlua_fcn.c
@@ -321,7 +321,7 @@ static int hlua_get_info(lua_State *L)

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 @@ int hlua_concat_new(lua_State *L)
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 @@ int hlua_fcn_new_listener(lua_State *L, struct listener *lst)

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 @@ int hlua_fcn_new_server(lua_State *L, struct server *srv)

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 @@ int hlua_fcn_new_proxy(lua_State *L, struct proxy *px)

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 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..56256fad1f7c 100644
--- a/src/peers.c
+++ b/src/peers.c
@@ -447,8 +447,8 @@ static void peer_session_release(struct appctx *appctx)
{
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 @@ static void peer_io_handler(struct appctx *appctx)
{
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 @@ switchstate:
/* 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 @@ switchstate:
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 @@ switchstate:
/* 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 @@ switchstate:
/* 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 @@ static void peer_session_forceshutdown(struct stream * stream)
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 @@ void peers_setup_frontend(struct proxy *fe)
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 stream *peer_session_create(struct peers *peers, struct peer *peer
*/
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 @@ 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 0b2001198d74..dc3fed51c741 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -8785,7 +8785,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;
@@ -9723,7 +9723,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..d511a2aba22b 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;
@@ -2667,7 +2667,7 @@ int snr_resolution_cb(struct dns_resolution *resolution, struct dns_nameserver *
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 snr_resolution_error_cb(struct dns_resolution *resolution, int error_code)
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 a22730a48b48..c561632fb314 100644
--- a/src/shctx.c
+++ b/src/shctx.c
@@ -624,7 +624,7 @@ int shared_context_init(int size, int shared)
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 994cdcc640b6..7b09c8e14758 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -474,7 +474,7 @@ static int ssl_tlsext_ticket_key_cb(SSL *s, unsigned char key_name[16], unsigned
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 ssl_sock_ocsp_stapling_cbk(SSL *ssl, void *arg)
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 @@ static int ssl_sock_load_ocsp(SSL_CTX *ctx, const char *cert_path)
* 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 @@ end:

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 @@ out:

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 ssl_sock_bind_verifycbk(int ok, X509_STORE_CTX *x_store)
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 @@ void ssl_sock_msgcbk(int write_p, int version, int content_type, const void *buf
/* 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 @@ static int ssl_sock_switchctx_cbk(SSL *ssl, int *al, struct bind_conf *s)
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 @@ static int ssl_sock_srv_verifycbk(int ok, X509_STORE_CTX *ctx)
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 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/stick_table.c b/src/stick_table.c
index e5bb168d7bd1..0d154907b783 100644
--- a/src/stick_table.c
+++ b/src/stick_table.c
@@ -383,7 +383,7 @@ static int stktable_trash_expired(struct stktable *t)
*/
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 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;
diff --git a/src/xxhash.c b/src/xxhash.c
index 3454691233c0..5702e64f5ca1 100644
--- a/src/xxhash.c
+++ b/src/xxhash.c
@@ -253,7 +253,7 @@ FORCE_INLINE U64 XXH_readLE64(const void* ptr, XXH_endianess endian)
//****************************
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 @@ unsigned int XXH32 (const void* input, size_t len, unsigned seed)

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 @@ XXH_errorcode XXH64_reset(XXH64_state_t* state_in, unsigned long long seed)
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 @@ U32 XXH32_digest (const XXH32_state_t* state_in)
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
diff --git a/tests/filltab25.c b/tests/filltab25.c
index 02802bdb8bc2..c57f4207dede 100644
--- a/tests/filltab25.c
+++ b/tests/filltab25.c
@@ -194,7 +194,7 @@ main(int argc, char **argv) {
if (!nsrv)
exit(1);

- srv = (struct srv *)calloc(nsrv, sizeof(struct srv));
+ srv = calloc(nsrv, sizeof(struct srv));

sw = 0;
for (i = 0; i < nsrv; i++) {
--
2.8.0.rc3

RE-CONSTRUCTION (no replies)

$
0
0
Dear Sir/Madam,
My name is Alhaji Abubakar Magaji, PERMANENT SECRETARY MINISTRY OF WORKS, is your company capable to handle contracts and supply of your products/services as a contractor towards the project of rebuilding Nigeria.
Construction contract include: Bridge, Roads, Railways, Airports, Building and renovation of Power and Water systems, schools and hospitals, Mining, fire, oil & gas infrastructure, Police and Military services and the modernization of communications systems.
Non-construction activities include equipment supplies and training in all sectors.
If your company is in these categories and capable of construction/contract projects send in your company profile for further details in this projects.
Thank you and Best Regards,
Alhaji Abubakar Magaji
PERMANENT SECRETARY MINISTRY OF WORKS

Federal Ministry of Power, Works & Housing
Headquarters, Mabuchi, Abuja F.C.T Nigeria.
Phone: +234 9050093701

[CLEANUP]: proto_http (no replies)

$
0
0
HI all,

After the important cleanup of this week end, here a much more modest one.
Basically some gcc warnings suppressions.

Hope it is useful.

[SPAM] Refund for #23546 - $4,986,85 (no replies)

$
0
0
Your refund request has been processed.Please, find the confirmation attached to this e-mail.
Viewing all 5112 articles
Browse latest View live




Latest Images