]> git.dujemihanovic.xyz Git - u-boot.git/commit
cmd_test: use table lookup for parsing
authorStephen Warren <swarren@nvidia.com>
Mon, 3 Feb 2014 20:21:02 +0000 (13:21 -0700)
committerTom Rini <trini@ti.com>
Wed, 19 Feb 2014 14:47:33 +0000 (09:47 -0500)
commit490ba833d5a7804ca81b13b3f8f2c37aadc40009
tree5f7e2a4658c2b1c92a7b8d90afb747be563dad97
parent377202b5604e9e17074955538dc8081169a43137
cmd_test: use table lookup for parsing

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>
common/cmd_test.c