Skip to content

Commit c1d0743

Browse files
author
Antonio Quartulli
committed
batman-adv: don't use !! in bool conversion
In C standard any expression different from 0 will be converted to 'true' when casting to bool (whatever is the length of the value). Therefore all the "!!" conversions can be removed. Signed-off-by: Antonio Quartulli <[email protected]> Signed-off-by: Marek Lindner <[email protected]>
1 parent f86ce0a commit c1d0743

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

net/batman-adv/translation-table.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ int batadv_tt_global_add(struct batadv_priv *bat_priv,
902902
/* remove address from local hash if present */
903903
local_flags = batadv_tt_local_remove(bat_priv, tt_addr,
904904
"global tt received",
905-
!!(flags & BATADV_TT_CLIENT_ROAM));
905+
flags & BATADV_TT_CLIENT_ROAM);
906906
tt_global_entry->common.flags |= local_flags & BATADV_TT_CLIENT_WIFI;
907907

908908
if (!(flags & BATADV_TT_CLIENT_ROAM))
@@ -2515,7 +2515,7 @@ bool batadv_tt_global_client_is_roaming(struct batadv_priv *bat_priv,
25152515
if (!tt_global_entry)
25162516
goto out;
25172517

2518-
ret = !!(tt_global_entry->common.flags & BATADV_TT_CLIENT_ROAM);
2518+
ret = tt_global_entry->common.flags & BATADV_TT_CLIENT_ROAM;
25192519
batadv_tt_global_entry_free_ref(tt_global_entry);
25202520
out:
25212521
return ret;

net/batman-adv/unicast.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,15 @@ batadv_frag_search_packet(struct list_head *head,
122122
{
123123
struct batadv_frag_packet_list_entry *tfp;
124124
struct batadv_unicast_frag_packet *tmp_up = NULL;
125-
int is_head_tmp, is_head;
125+
bool is_head_tmp, is_head;
126126
uint16_t search_seqno;
127127

128128
if (up->flags & BATADV_UNI_FRAG_HEAD)
129129
search_seqno = ntohs(up->seqno)+1;
130130
else
131131
search_seqno = ntohs(up->seqno)-1;
132132

133-
is_head = !!(up->flags & BATADV_UNI_FRAG_HEAD);
133+
is_head = up->flags & BATADV_UNI_FRAG_HEAD;
134134

135135
list_for_each_entry(tfp, head, list) {
136136
if (!tfp->skb)
@@ -142,7 +142,7 @@ batadv_frag_search_packet(struct list_head *head,
142142
tmp_up = (struct batadv_unicast_frag_packet *)tfp->skb->data;
143143

144144
if (tfp->seqno == search_seqno) {
145-
is_head_tmp = !!(tmp_up->flags & BATADV_UNI_FRAG_HEAD);
145+
is_head_tmp = tmp_up->flags & BATADV_UNI_FRAG_HEAD;
146146
if (is_head_tmp != is_head)
147147
return tfp;
148148
else

0 commit comments

Comments
 (0)