[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z6m1qtlyCece4e2g@vaxr-BM6660-BM6360>
Date: Mon, 10 Feb 2025 16:15:38 +0800
From: I Hsin Cheng <richard120310@...il.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: pmladek@...e.com, rostedt@...dmis.org, linux@...musvillemoes.dk,
senozhatsky@...omium.org, akpm@...ux-foundation.org,
linux-kernel@...r.kernel.org, jserv@...s.ncku.edu.tw,
shuah@...nel.org
Subject: Re: [PATCH] vsprintf: Drop unused assignment of fmt.state
On Thu, Feb 06, 2025 at 05:32:32PM +0200, Andy Shevchenko wrote:
> On Thu, Feb 06, 2025 at 01:25:07AM +0800, I Hsin Cheng wrote:
> > Remove unused assignment of "fmt.state", in both cases the value of
> > "fmt.state" will be overwritten by either "FORMAT_STATE_PRECISION" or
> > "FORMAT_STATE_NUM", the value "FORMAT_STATE_NONE" isn't going to be used
> > after the assignment.
>
> ...
>
> > struct fmt format_decode(struct fmt fmt, struct printf_spec *spec)
>
> > spec->field_width = -spec->field_width;
> > spec->flags |= LEFT;
> > }
> > - fmt.state = FORMAT_STATE_NONE;
> > +
> > goto precision;
> > }
> >
>
> While both are kinda redundant, this is not obvious what's stated in the commit
> message. Yes, `goto qualifier;` is straightforward, but not `goto precision;`.
> Which makes me think that these assignments can make code robust against
> potential future changes to allow to catch up the wrong code paths.
>
> Whatever maintainers decide, technically the change looks correct to me.
>
> ...
>
> > if (spec->precision < 0)
> > spec->precision = 0;
> >
> > - fmt.state = FORMAT_STATE_NONE;
> > +
>
> What's the reason to add an extra blank line? (We have already one here)
>
> > goto qualifier;
> > }
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
Hi Andy,
Thanks for your kindly review!
> What's the reason to add an extra blank line? (We have already one here)
Well I think I didn't intentionally add a blank line here, I simply
delete the assigment but left the line there. I'll have it deleted as
well if the maintainers decided to make any change.
Best regards,
I Hsin Cheng
Powered by blists - more mailing lists