[systemd-devel] [PATCH 07/11] libsystemd-dhcp: Check test result without casting value

Patrik Flykt patrik.flykt at linux.intel.com
Fri Dec 20 07:16:16 PST 2013


---
 src/libsystemd-dhcp/test-dhcp-client.c |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/libsystemd-dhcp/test-dhcp-client.c b/src/libsystemd-dhcp/test-dhcp-client.c
index 7400cc6..1ff78c1 100644
--- a/src/libsystemd-dhcp/test-dhcp-client.c
+++ b/src/libsystemd-dhcp/test-dhcp-client.c
@@ -119,13 +119,7 @@ static void test_checksum(void)
                 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,
-- 
1.7.10.4



More information about the systemd-devel mailing list