All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Nazzareno Trimarchi <michael@amarulasolutions.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] cmd: avoid decimal conversion
Date: Fri, 13 Sep 2019 17:17:33 +0200	[thread overview]
Message-ID: <CAOf5uwmDuH+4EMvNmPnZyGiLQtbZ6dgNkV-9iK7DFL7+JK=_sA@mail.gmail.com> (raw)
In-Reply-To: <20190913150905.GA5945@hodge-podge>

On Fri, Sep 13, 2019 at 5:10 PM Tom Rini <trini@konsulko.com> wrote:
>
> On Wed, Sep 11, 2019 at 03:39:53PM +0200, Michal Simek wrote:
>
> > From: T Karthik Reddy <t.karthik.reddy@xilinx.com>
> >
> > This patch uses auto instead of decimal in simple_strtoul().
> >
> > Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
> > Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> > ---
> >
> >  cmd/test.c | 24 ++++++++++++------------
> >  1 file changed, 12 insertions(+), 12 deletions(-)
> >
> > diff --git a/cmd/test.c b/cmd/test.c
> > index fa0c349f0827..258bfd880653 100644
> > --- a/cmd/test.c
> > +++ b/cmd/test.c
> > @@ -113,28 +113,28 @@ static int do_test(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> >                       expr = strcmp(ap[0], ap[2]) > 0;
> >                       break;
> >               case OP_INT_EQ:
> > -                     expr = simple_strtol(ap[0], NULL, 10) ==
> > -                                     simple_strtol(ap[2], NULL, 10);
> > +                     expr = simple_strtol(ap[0], NULL, 0) ==
> > +                                     simple_strtol(ap[2], NULL, 0);
> >                       break;
> >               case OP_INT_NEQ:
> > -                     expr = simple_strtol(ap[0], NULL, 10) !=
> > -                                     simple_strtol(ap[2], NULL, 10);
> > +                     expr = simple_strtol(ap[0], NULL, 0) !=
> > +                                     simple_strtol(ap[2], NULL, 0);
> >                       break;
> >               case OP_INT_LT:
> > -                     expr = simple_strtol(ap[0], NULL, 10) <
> > -                                     simple_strtol(ap[2], NULL, 10);
> > +                     expr = simple_strtol(ap[0], NULL, 0) <
> > +                                     simple_strtol(ap[2], NULL, 0);
> >                       break;
> >               case OP_INT_LE:
> > -                     expr = simple_strtol(ap[0], NULL, 10) <=
> > -                                     simple_strtol(ap[2], NULL, 10);
> > +                     expr = simple_strtol(ap[0], NULL, 0) <=
> > +                                     simple_strtol(ap[2], NULL, 0);
> >                       break;
> >               case OP_INT_GT:
> > -                     expr = simple_strtol(ap[0], NULL, 10) >
> > -                                     simple_strtol(ap[2], NULL, 10);
> > +                     expr = simple_strtol(ap[0], NULL, 0) >
> > +                                     simple_strtol(ap[2], NULL, 0);
> >                       break;
> >               case OP_INT_GE:
> > -                     expr = simple_strtol(ap[0], NULL, 10) >=
> > -                                     simple_strtol(ap[2], NULL, 10);
> > +                     expr = simple_strtol(ap[0], NULL, 0) >=
> > +                                     simple_strtol(ap[2], NULL, 0);
> >                       break;
> >               case OP_FILE_EXISTS:
> >                       expr = file_exists(ap[1], ap[2], ap[3], FS_TYPE_ANY);
>
> I'm going to NAK this, but could be argued around to changing my mind.
> While it's true that in general command inputs are hex and not decimal,
> this has been decimal since introduction in 2009.  So changing it now is
> breaking ABI and other peoples test scripts, so I don't think we can do
> this, sorry.

Well, I think that this is automatic. There should be a back compatibility
with the ABI if base is 10

Michael

>
> --
> Tom
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot



--
| Michael Nazzareno Trimarchi                     Amarula Solutions BV |
| COO  -  Founder                                      Cruquiuskade 47 |
| +31(0)851119172                                 Amsterdam 1018 AM NL |
|                  [`as] http://www.amarulasolutions.com               |

  reply	other threads:[~2019-09-13 15:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-11 13:39 [U-Boot] [PATCH] cmd: avoid decimal conversion Michal Simek
2019-09-13 15:09 ` Tom Rini
2019-09-13 15:17   ` Michael Nazzareno Trimarchi [this message]
2019-09-19 13:28   ` Michal Simek
2019-10-08  8:48     ` Michal Simek
2019-10-09 16:26       ` Tom Rini
2019-10-09 17:28         ` Simon Goldschmidt
2019-10-10 10:46           ` Michal Simek
2019-10-10 10:49             ` Simon Goldschmidt
2019-10-12 20:23 ` Tom Rini

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='CAOf5uwmDuH+4EMvNmPnZyGiLQtbZ6dgNkV-9iK7DFL7+JK=_sA@mail.gmail.com' \
    --to=michael@amarulasolutions.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.