]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
basic: simplify ether_addr_is_null
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 23 Feb 2016 13:17:19 +0000 (08:17 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 23 Feb 2016 13:50:49 +0000 (08:50 -0500)
src/basic/ether-addr-util.c
src/basic/ether-addr-util.h

index d2c030903b834443cc5f24d7bf2681f4a6349b27..a4d8d656dabcf889ee4972a2e9677791971215ee 100644 (file)
@@ -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);
index 00c5159fe8a1755652ffdc6e144ff0cbabd4a753..074363793e78e467efc125258ec6995c1b58a86e 100644 (file)
 #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);
+}