Skip to content
Snippets Groups Projects
Forked from Reform / reform-boundary-uboot
Source project has a limited visibility.
  • Stephen Warren's avatar
    490ba833
    cmd_test: use table lookup for parsing · 490ba833
    Stephen Warren authored
    
    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: default avatarStephen Warren <swarren@nvidia.com>
    490ba833
    History
    cmd_test: use table lookup for parsing
    Stephen Warren authored
    
    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: default avatarStephen Warren <swarren@nvidia.com>