summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-02-23 08:17:19 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-02-23 08:50:49 -0500
commit6b0132e4e785de7b339da071eb1506adf2362edd (patch)
treeafd293970f03a622b71e43febf947d14db0ee386 /src/basic
parent953d28cc21d25dc61f886d61d628b577aed4e042 (diff)
basic: simplify ether_addr_is_null
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/ether-addr-util.c11
-rw-r--r--src/basic/ether-addr-util.h7
2 files changed, 6 insertions, 12 deletions
diff --git a/src/basic/ether-addr-util.c b/src/basic/ether-addr-util.c
index d2c030903b..a4d8d656da 100644
--- a/src/basic/ether-addr-util.c
+++ b/src/basic/ether-addr-util.c
@@ -43,17 +43,6 @@ char* ether_addr_to_string(const struct ether_addr *addr, char buffer[ETHER_ADDR
return buffer;
}
-bool ether_addr_is_null(const struct ether_addr *addr) {
- assert(addr);
-
- return addr->ether_addr_octet[0] == 0 &&
- addr->ether_addr_octet[1] == 0 &&
- addr->ether_addr_octet[2] == 0 &&
- addr->ether_addr_octet[3] == 0 &&
- addr->ether_addr_octet[4] == 0 &&
- addr->ether_addr_octet[5] == 0;
-}
-
bool ether_addr_equal(const struct ether_addr *a, const struct ether_addr *b) {
assert(a);
assert(b);
diff --git a/src/basic/ether-addr-util.h b/src/basic/ether-addr-util.h
index 00c5159fe8..074363793e 100644
--- a/src/basic/ether-addr-util.h
+++ b/src/basic/ether-addr-util.h
@@ -28,5 +28,10 @@
#define ETHER_ADDR_TO_STRING_MAX (3*6)
char* ether_addr_to_string(const struct ether_addr *addr, char buffer[ETHER_ADDR_TO_STRING_MAX]);
-bool ether_addr_is_null(const struct ether_addr *addr);
bool ether_addr_equal(const struct ether_addr *a, const struct ether_addr *b);
+
+#define ETHER_ADDR_NULL ((const struct ether_addr){})
+
+static inline bool ether_addr_is_null(const struct ether_addr *addr) {
+ return ether_addr_equal(addr, &ETHER_ADDR_NULL);
+}