Re: [PATCH v2 2/3] lib/vsprintf: Replace custom spec to print decimals with generic one

From: Sergey Senozhatsky
Date: Fri Jul 31 2020 - 21:42:21 EST


On (20/07/31 16:48), Steven Rostedt wrote:
[..]
> > > - static const struct printf_spec num_spec = {
> > > - .flags = SMALL,
> > > - .field_width = -1,
> > > - .precision = -1,
> > > - .base = 10,
> > > - };
> > >
> > > struct printf_spec str_spec = spec;
> > > str_spec.field_width = -1;
> > > @@ -2024,7 +2018,7 @@ char *device_node_string(char *buf, char *end, struct device_node *dn,
> > > str_spec.precision = precision;
> > > break;
> > > case 'p': /* phandle */
> > > - buf = number(buf, end, (unsigned int)dn->phandle, num_spec);
> > > + buf = number(buf, end, (unsigned int)dn->phandle, default_dec_spec);
> >
> > Could changing .precision = -1 to 0 change any output?
> >
>
> static const struct printf_spec default_dec_spec = {
> .base = 10,
> .precision = -1,
> };
>
>
> It's the field_width that changes from -1 to 0, which shouldn't cause
> any issue.

That's a good question, both .field_width and .precision are now zeroes,
and not -1. But it seems that this doesn't change anything in the end.

Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@xxxxxxxxx>

-ss