batctl: Avoid boolean in structures
PATCH 1/1 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 <[email protected]>
--- netlink.c | 8 ++++---- throughputmeter.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-)
netlink.c +4 -4
@@ -592,7 +592,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; };
@@ -680,7 +680,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; };
@@ -772,7 +772,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; };
@@ -844,7 +844,7 @@ int get_primarymac_netlink(const char *mesh_iface, 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; };
throughputmeter.c +2 -2
@@ -38,16 +38,16 @@ static char *tp_mesh_iface;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; };
Signature · 1 line
2.30.2