openocd: fix simple cases of Yoda condition
There are ~900 Yoda conditions to be aligned to the coding style.
For recurrent Yoda conditions it's preferable using a trivial
script in order to minimize the review effort.
E.g. comparison of uppercase macro/enum with lowercase variable:
- ...(ERROR_OK == retval)...
+ ...(retval == ERROR_OK)...
Patch generated automatically with the command:
sed -i \
's/(\([A-Z][A-Z0-9_]*\) \([=!]=\) \([a-z][a-z0-9_]*\))/(\3 \2 \1)/g' \
$(find src/ -type f)
While there, remove the braces {} around a single statement block
to prevent warning from checkpatch.
Change-Id: If585b0a4b4578879c87b2dd74d9e0025e275ec6b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6354
Tested-by: jenkins
Reviewed-by: Xiang W <wxjstz@126.com>
This commit is contained in:
@@ -427,7 +427,7 @@ DECLARE_PARSE_WRAPPER(_target_addr, target_addr_t);
|
||||
#define COMMAND_PARSE_NUMBER(type, in, out) \
|
||||
do { \
|
||||
int retval_macro_tmp = parse_ ## type(in, &(out)); \
|
||||
if (ERROR_OK != retval_macro_tmp) { \
|
||||
if (retval_macro_tmp != ERROR_OK) { \
|
||||
command_print(CMD, stringify(out) \
|
||||
" option value ('%s') is not valid", in); \
|
||||
return retval_macro_tmp; \
|
||||
@@ -489,7 +489,7 @@ DECLARE_PARSE_WRAPPER(_target_addr, target_addr_t);
|
||||
do { \
|
||||
bool value; \
|
||||
int retval_macro_tmp = command_parse_bool_arg(in, &value); \
|
||||
if (ERROR_OK != retval_macro_tmp) { \
|
||||
if (retval_macro_tmp != ERROR_OK) { \
|
||||
command_print(CMD, stringify(out) \
|
||||
" option value ('%s') is not valid", in); \
|
||||
command_print(CMD, " choices are '%s' or '%s'", \
|
||||
|
||||
Reference in New Issue
Block a user