[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20161205172432.GO21576@orbyte.nwl.cc>
Date: Mon, 5 Dec 2016 18:24:32 +0100
From: Phil Sutter <phil@....cc>
To: David Laight <David.Laight@...LAB.COM>
Cc: Stephen Hemminger <stephen@...workplumber.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [iproute PATCH v2 08/18] ss: Turn generic_proc_open() wrappers
into macros
On Mon, Dec 05, 2016 at 05:02:20PM +0000, David Laight wrote:
> From: Phil Sutter
> > Sent: 02 December 2016 10:40
> > Signed-off-by: Phil Sutter <phil@....cc>
> > ---
> > misc/ss.c | 89 ++++++++++++++-------------------------------------------------
> > 1 file changed, 19 insertions(+), 70 deletions(-)
> >
> > diff --git a/misc/ss.c b/misc/ss.c
> > index ad38eb97b0055..71040a82ca6b1 100644
> > --- a/misc/ss.c
> > +++ b/misc/ss.c
> > @@ -327,76 +327,25 @@ static FILE *generic_proc_open(const char *env, const char *name)
> >
> > return fopen(p, "r");
> > }
> > -
> > -static FILE *net_tcp_open(void)
> > -{
> > - return generic_proc_open("PROC_NET_TCP", "net/tcp");
> > -}
> ...
> > +#define net_tcp_open() generic_proc_open("PROC_NET_TCP", "net/tcp")
> ...
>
> Does that make any difference at all?
> The compiler should inline the static functions.
Probably, yes. My motivation behind it was merely the reduced LoC (and
maybe the improved clarity how these are really just wrappers, but
that's personal preference I guess).
Cheers, Phil
Powered by blists - more mailing lists