cmd_test: use table lookup for parsing
authorStephen Warren <swarren@nvidia.com>
Mon, 3 Feb 2014 20:21:02 +0000 (13:21 -0700)
committerjino.cho <jino.cho@samsung.com>
Tue, 28 Feb 2017 10:10:34 +0000 (19:10 +0900)
commita75c04813d669e2fd65e47cdc6e948ae7abe13e2
treee4915131cb209a100cfa9041b7dfc2b327993803
parent69e611b7a557d62b01ff25f5a6b6d24aee5e6b16
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>
Conflicts:
common/cmd_test.c

Change-Id: I2966c40c9f0c502fbb800d6ee058617a2c87666c
common/cmd_test.c