chiark / gitweb /
libsystemd-dhcp: Check test result without casting value
authorPatrik Flykt <patrik.flykt@linux.intel.com>
Fri, 20 Dec 2013 15:16:16 +0000 (17:16 +0200)
committerTom Gundersen <teg@jklm.no>
Sun, 22 Dec 2013 13:28:00 +0000 (14:28 +0100)
src/libsystemd-dhcp/test-dhcp-client.c

index 7400cc6837e72b48fd22692d031f7beab871cab9..1ff78c11440cec7a1db19efeeec367bf1bb20d3d 100644 (file)
@@ -119,13 +119,7 @@ static void test_checksum(void)
                 0xff, 0xff, 0xff, 0xff
         };
 
                 0xff, 0xff, 0xff, 0xff
         };
 
-        uint8_t check[2] = {
-                0x78, 0xae
-        };
-
-        uint16_t *val = (uint16_t *)check;
-
-        assert(client_checksum(&buf, 20) == *val);
+        assert(client_checksum(&buf, 20) == be16toh(0x78ae));
 }
 
 static int check_options(uint8_t code, uint8_t len, const uint8_t *option,
 }
 
 static int check_options(uint8_t code, uint8_t len, const uint8_t *option,