From: Jakub Sitnicki <jkbs@redhat.com>
To: Phil Sutter <phil@nwl.cc>
Cc: Stephen Hemminger <shemming@brocade.com>,
Daniel Borkmann <daniel@iogearbox.net>,
David Ahern <dsa@cumulusnetworks.com>,
Nicolas Dichtel <nicolas.dichtel@6wind.com>,
Julien Floret <julien.floret@6wind.com>,
netdev@vger.kernel.org
Subject: Re: [iproute PATCH v2 2/7] Use C99 style initializers everywhere
Date: Wed, 22 Jun 2016 11:12:14 +0200 [thread overview]
Message-ID: <87mvmdmvtd.fsf@frog.home> (raw)
In-Reply-To: <1466525921-15738-3-git-send-email-phil@nwl.cc>
Hi Phil,
On Tue, Jun 21, 2016 at 06:18 PM CEST, Phil Sutter <phil@nwl.cc> wrote:
> This big patch was compiled by vimgrepping for memset calls and changing
> to C99 initializer if applicable. One notable exception is the
> initialization of union bpf_attr in tc/tc_bpf.c: changing it would break
> for older gcc versions (at least <=3.4.6).
>
> Calls to memset for struct rtattr pointer fields for parse_rtattr*()
> were just dropped since they are not needed.
>
> The changes here allowed the compiler to discover some unused variables,
> so get rid of them, too.
>
> Signed-off-by: Phil Sutter <phil@nwl.cc>
> ---
[...]
> diff --git a/bridge/fdb.c b/bridge/fdb.c
> index be849f980a802..a59d6a9c13018 100644
> --- a/bridge/fdb.c
> +++ b/bridge/fdb.c
> @@ -177,16 +177,15 @@ static int fdb_show(int argc, char **argv)
> struct nlmsghdr n;
> struct ifinfomsg ifm;
> char buf[256];
> - } req;
> + } req = {
> + .n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg)),
> + .ifm.ifi_family = PF_BRIDGE
> + };
>
A comma is allowed after a list of initializers (IOW, after the last
initializer). Having it would make for smaller/cleaner diffs in the
future if new structure members get added and need to be initialized.
Thanks,
Jakub
next prev parent reply other threads:[~2016-06-22 9:12 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-21 16:18 [iproute PATCH v2 0/7] Big C99 style initializer rework Phil Sutter
2016-06-21 16:18 ` [iproute PATCH v2 1/7] tc: m_action: Improve conversion to C99 style initializers Phil Sutter
2016-06-21 16:18 ` [iproute PATCH v2 2/7] Use C99 style initializers everywhere Phil Sutter
2016-06-21 16:24 ` David Ahern
2016-06-21 17:03 ` Phil Sutter
2016-06-21 17:13 ` David Ahern
2016-06-21 17:17 ` Phil Sutter
2016-06-21 18:30 ` Stephen Hemminger
2016-06-22 9:12 ` Jakub Sitnicki [this message]
2016-06-22 9:29 ` Phil Sutter
2016-06-22 9:41 ` Jakub Sitnicki
2016-06-21 16:18 ` [iproute PATCH v2 3/7] Replace malloc && memset by calloc Phil Sutter
2016-06-21 16:18 ` [iproute PATCH v2 4/7] No need to initialize rtattr fields before parsing Phil Sutter
2016-06-21 16:18 ` [iproute PATCH v2 5/7] Makefile: Allow to override CC Phil Sutter
2016-06-21 16:18 ` [iproute PATCH v2 6/7] misc/ifstat: simplify unsigned value comparison Phil Sutter
2016-06-21 16:18 ` [iproute PATCH v2 7/7] ip/tcp_metrics: Simplify process_msg a bit Phil Sutter
2016-06-21 16:29 ` David Laight
2016-06-21 16:53 ` Stephen Hemminger
2016-06-21 17:07 ` Phil Sutter
2016-06-22 11:34 ` Jakub Sitnicki
2016-06-22 12:55 ` Phil Sutter
2016-06-22 13:00 ` David Laight
2016-06-22 13:08 ` Phil Sutter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mvmdmvtd.fsf@frog.home \
--to=jkbs@redhat.com \
--cc=daniel@iogearbox.net \
--cc=dsa@cumulusnetworks.com \
--cc=julien.floret@6wind.com \
--cc=netdev@vger.kernel.org \
--cc=nicolas.dichtel@6wind.com \
--cc=phil@nwl.cc \
--cc=shemming@brocade.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).