readability fix: No assigns in if conditionals
Coccinelle-assisted:
@@
variable i;
expression E;
statement S1, S2;
@@
+ i = E;
if (
(
- (i = E)
+ i
!= ...
|
- (i = E)
+ i
== ...
|
- (i = E)
+ i
< ...
|
- (i = E)
+ i
> ...
|
- (i = E)
+ i
<= ...
|
- (i = E)
+ i
>= ...
|
- (i = E)
+ i
)
) S1 else S2
for file in $(find . -name "*.cc"); do
spatch --sp no-if-assigns.cocci --in-place $file
done
clang-format --style=file -i bta/**/*.cc
Test: mma -j37 and basic sanity testing on angler, sailfish
Change-Id: I41a2964afac347c24e13869b6c172e321e646091
diff --git a/bta/dm/bta_dm_main.cc b/bta/dm/bta_dm_main.cc
index b8c572b..3d25691 100644
--- a/bta/dm/bta_dm_main.cc
+++ b/bta/dm/bta_dm_main.cc
@@ -343,8 +343,8 @@
/* execute action functions */
for (i = 0; i < BTA_DM_SEARCH_ACTIONS; i++) {
- if ((action = state_table[p_msg->event & 0x00ff][i]) !=
- BTA_DM_SEARCH_IGNORE) {
+ action = state_table[p_msg->event & 0x00ff][i];
+ if (action != BTA_DM_SEARCH_IGNORE) {
(*bta_dm_search_action[action])((tBTA_DM_MSG*)p_msg);
} else {
break;