From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V3 04/12] cmd_test: use table lookup for parsing
Date: Mon, 03 Feb 2014 13:19:36 -0700 [thread overview]
Message-ID: <52EFF9D8.1050902@wwwdotorg.org> (raw)
In-Reply-To: <CAPnjgZ03aSpXTqMHZwzO0oMKWYQs+V5ZCppwhBXP8LQ2op-piw@mail.gmail.com>
On 01/31/2014 05:03 PM, Simon Glass wrote:
> Hi Stephen,
>
> On 27 January 2014 13:49, Stephen Warren <swarren@wwwdotorg.org> wrote:
>> From: Stephen Warren <swarren@nvidia.com>
>>
>> do_test() currently uses strcmp() twice to determine which operator is
>> present; once to determine how many arguments the operator needs, then
>> a second time to actually decode the operator and implement it.
>>
>> Rewrite the code so that a table lookup is used to translate the operator
>> string to an integer, and use a more efficient switch statement to decode
>> and execute the operator.
>>
>> This approach also acts as enablement for the following patches.
>>
>> This patch should introduce no behavioural change.
>>
>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>> ---
>> v3: New patch.
>
> Wow that's some interesting code...it took me a while to understand
> both the old and the new code. It looks correct to me but I wonder if
> it is deserving of some tests? Something like test/command_ut.c might
> show a simple way to run some tests.
OK, I'll send V4 of this series with your minor issues addressed, and
I'll send a separate follow-on series which adds the unit tests, just so
it doesn't delay or cause revisions to the main series.
next prev parent reply other threads:[~2014-02-03 20:19 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-27 20:49 [U-Boot] [PATCH V3 01/12] fs: fix generic save command implementation Stephen Warren
2014-01-27 20:49 ` [U-Boot] [PATCH V3 02/12] fs: implement infra-structure for an 'exists' function Stephen Warren
2014-01-31 21:56 ` Simon Glass
2014-01-27 20:49 ` [U-Boot] [PATCH V3 03/12] fs: don't pass NULL dev_desc to most filesystems Stephen Warren
2014-01-31 21:57 ` Simon Glass
2014-01-27 20:49 ` [U-Boot] [PATCH V3 04/12] cmd_test: use table lookup for parsing Stephen Warren
2014-02-01 0:03 ` Simon Glass
2014-02-03 20:19 ` Stephen Warren [this message]
2014-02-03 20:37 ` Simon Glass
2014-01-27 20:49 ` [U-Boot] [PATCH V3 05/12] cmd_test: check for binary operators before unary Stephen Warren
2014-01-27 20:49 ` [U-Boot] [PATCH V3 06/12] cmd_test: implement ! on sub-expressions Stephen Warren
2014-01-27 20:49 ` [U-Boot] [PATCH V3 07/12] cmd_test: evaluate to false without any arguments Stephen Warren
2014-01-27 20:49 ` [U-Boot] [PATCH V3 08/12] cmd_test: implement -e test for file existence Stephen Warren
2014-02-01 0:04 ` Simon Glass
2014-01-27 20:49 ` [U-Boot] [PATCH V3 09/12] sandbox: implement exists() function Stephen Warren
2014-01-27 20:50 ` [U-Boot] [PATCH V3 10/12] sandbox: enable CONFIG_CMD_FS_GENERIC Stephen Warren
2014-02-01 0:05 ` Simon Glass
2014-01-27 20:50 ` [U-Boot] [PATCH V3 11/12] ext4: implement exists() for ext4fs Stephen Warren
2014-01-27 20:50 ` [U-Boot] [PATCH V3 12/12] fat: implement exists() for FAT fs Stephen Warren
2014-02-01 0:06 ` Simon Glass
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=52EFF9D8.1050902@wwwdotorg.org \
--to=swarren@wwwdotorg.org \
--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.