Skip to content

Commit

Permalink
batman-adv: don't use !! in bool conversion
Browse files Browse the repository at this point in the history
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 <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
  • Loading branch information
Antonio Quartulli committed Mar 13, 2013
1 parent f86ce0a commit c1d0743
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions net/batman-adv/translation-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ int batadv_tt_global_add(struct batadv_priv *bat_priv,
/* remove address from local hash if present */
local_flags = batadv_tt_local_remove(bat_priv, tt_addr,
"global tt received",
!!(flags & BATADV_TT_CLIENT_ROAM));
flags & BATADV_TT_CLIENT_ROAM);
tt_global_entry->common.flags |= local_flags & BATADV_TT_CLIENT_WIFI;

if (!(flags & BATADV_TT_CLIENT_ROAM))
Expand Down Expand Up @@ -2515,7 +2515,7 @@ bool batadv_tt_global_client_is_roaming(struct batadv_priv *bat_priv,
if (!tt_global_entry)
goto out;

ret = !!(tt_global_entry->common.flags & BATADV_TT_CLIENT_ROAM);
ret = tt_global_entry->common.flags & BATADV_TT_CLIENT_ROAM;
batadv_tt_global_entry_free_ref(tt_global_entry);
out:
return ret;
Expand Down
6 changes: 3 additions & 3 deletions net/batman-adv/unicast.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ batadv_frag_search_packet(struct list_head *head,
{
struct batadv_frag_packet_list_entry *tfp;
struct batadv_unicast_frag_packet *tmp_up = NULL;
int is_head_tmp, is_head;
bool is_head_tmp, is_head;
uint16_t search_seqno;

if (up->flags & BATADV_UNI_FRAG_HEAD)
search_seqno = ntohs(up->seqno)+1;
else
search_seqno = ntohs(up->seqno)-1;

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

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

if (tfp->seqno == search_seqno) {
is_head_tmp = !!(tmp_up->flags & BATADV_UNI_FRAG_HEAD);
is_head_tmp = tmp_up->flags & BATADV_UNI_FRAG_HEAD;
if (is_head_tmp != is_head)
return tfp;
else
Expand Down

0 comments on commit c1d0743

Please sign in to comment.