* [B.A.T.M.A.N.] [PATCH] batman-adv: don't use !! in bool conversion
@ 2013-01-14 2:21 Antonio Quartulli
2013-01-14 3:40 ` Marek Lindner
0 siblings, 1 reply; 3+ messages in thread
From: Antonio Quartulli @ 2013-01-14 2:21 UTC (permalink / raw)
To: b.a.t.m.a.n
when converting an integer value to bool, whatever the length of the value is,
"!!" because of the standard Bool conversion definition
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
translation-table.c | 4 ++--
unicast.c | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/translation-table.c b/translation-table.c
index fb15b4c..e711b05 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -912,7 +912,7 @@ out_remove:
/* 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))
@@ -2540,7 +2540,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;
diff --git a/unicast.c b/unicast.c
index 50e079f..0bb3b59 100644
--- a/unicast.c
+++ b/unicast.c
@@ -122,7 +122,7 @@ 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)
@@ -130,7 +130,7 @@ batadv_frag_search_packet(struct list_head *head,
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)
@@ -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
--
1.8.0.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: don't use !! in bool conversion
2013-01-14 2:21 [B.A.T.M.A.N.] [PATCH] batman-adv: don't use !! in bool conversion Antonio Quartulli
@ 2013-01-14 3:40 ` Marek Lindner
2013-01-14 4:33 ` Antonio Quartulli
0 siblings, 1 reply; 3+ messages in thread
From: Marek Lindner @ 2013-01-14 3:40 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
On Monday, January 14, 2013 10:21:28 Antonio Quartulli wrote:
> when converting an integer value to bool, whatever the length of the value
> is, "!!" because of the standard Bool conversion definition
first of all, there is a verb missing somewhere. This sentence does not
compile. Secondly, it fails to explain *why* you are making that change.
Cheers,
Marek
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: don't use !! in bool conversion
2013-01-14 3:40 ` Marek Lindner
@ 2013-01-14 4:33 ` Antonio Quartulli
0 siblings, 0 replies; 3+ messages in thread
From: Antonio Quartulli @ 2013-01-14 4:33 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
[-- Attachment #1: Type: text/plain, Size: 684 bytes --]
On Mon, Jan 14, 2013 at 11:40:17AM +0800, Marek Lindner wrote:
> On Monday, January 14, 2013 10:21:28 Antonio Quartulli wrote:
> > when converting an integer value to bool, whatever the length of the value
> > is, "!!" because of the standard Bool conversion definition
>
> first of all, there is a verb missing somewhere. This sentence does not
> compile.
whoops, true. Changed the sentence too many times.
> Secondly, it fails to explain *why* you are making that change.
>
well, the "why" is implicit in the missing verb :D
"!! is useless". I'll send v2.
Cheers,
--
Antonio Quartulli
..each of us alone is worth nothing..
Ernesto "Che" Guevara
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-01-14 4:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-14 2:21 [B.A.T.M.A.N.] [PATCH] batman-adv: don't use !! in bool conversion Antonio Quartulli
2013-01-14 3:40 ` Marek Lindner
2013-01-14 4:33 ` Antonio Quartulli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).