[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210811090815.0a6363db@hermes.local>
Date: Wed, 11 Aug 2021 09:08:15 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: Andrea Claudi <aclaudi@...hat.com>
Cc: netdev@...r.kernel.org, dsahern@...il.com, haliu@...hat.com
Subject: Re: [PATCH iproute2] lib: bpf_glue: remove useless assignment
On Wed, 11 Aug 2021 11:12:43 +0200
Andrea Claudi <aclaudi@...hat.com> wrote:
> On Tue, Aug 10, 2021 at 08:00:48PM -0700, Stephen Hemminger wrote:
> > On Sat, 7 Aug 2021 18:58:02 +0200
> > Andrea Claudi <aclaudi@...hat.com> wrote:
> >
> > > - while ((s = fgets(buf, sizeof(buf), fp)) != NULL) {
> > > + while (fgets(buf, sizeof(buf), fp) != NULL) {
> > > if ((s = strstr(buf, "libbpf.so.")) != NULL) {
> >
> > Ok. but it would be good to get rid of the unnecessary assignment in conditional as well.
> >
> Hi Stephen,
> That's not unnecessary, s is used as the second parameter in the following strncpy().
>
It is bad style in C to do assignment in a conditional.
It causes errors, and is not anymore efficient.
Powered by blists - more mailing lists