Repository : ssh://git@diktynna/batctl
On branch : master
commit 62af39f7f7be62d4ecff1c57a1ea4fadf28f7b3e Author: Sven Eckelmann sven@narfation.org Date: Mon May 10 15:39:06 2021 +0200
batctl: Avoid boolean in structures
Booleans inside structures to really only store a single bit of information is often a waste of space because a boolean is stored using multiple bytes. While this is not too relevant for batctl, just use the same way of storing such values as in the rest of batman-adv to avoid different paradigms in related code.
Signed-off-by: Sven Eckelmann sven@narfation.org
62af39f7f7be62d4ecff1c57a1ea4fadf28f7b3e netlink.c | 8 ++++---- throughputmeter.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/netlink.c b/netlink.c index 7afd38b..eb5888b 100644 --- a/netlink.c +++ b/netlink.c @@ -677,7 +677,7 @@ static const int translate_mac_netlink_mandatory[] = {
struct translate_mac_netlink_opts { struct ether_addr mac; - bool found; + uint8_t found:1; struct nlquery_opts query_opts; };
@@ -765,7 +765,7 @@ struct get_nexthop_netlink_opts { struct ether_addr mac; uint8_t *nexthop; char *ifname; - bool found; + uint8_t found:1; struct nlquery_opts query_opts; };
@@ -865,7 +865,7 @@ static const int get_primarymac_netlink_mandatory[] = {
struct get_primarymac_netlink_opts { uint8_t *primarymac; - bool found; + uint8_t found:1; struct nlquery_opts query_opts; };
@@ -938,7 +938,7 @@ int get_primarymac_netlink(struct state *state, uint8_t *primarymac) struct get_algoname_netlink_opts { char *algoname; size_t algoname_len; - bool found; + uint8_t found:1; struct nlquery_opts query_opts; };
diff --git a/throughputmeter.c b/throughputmeter.c index 7f89651..fb1e35b 100644 --- a/throughputmeter.c +++ b/throughputmeter.c @@ -38,16 +38,16 @@ static struct state *tp_state;
struct tp_result { int error; - bool found; uint32_t cookie; uint8_t return_value; + uint8_t found:1; uint32_t test_time; uint64_t total_bytes; };
struct tp_cookie { int error; - bool found; + uint8_t found:1; uint32_t cookie; };