]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: use official bswap_32() rather than inofficial __bswap_32()
authorLennart Poettering <lennart@poettering.net>
Mon, 11 Oct 2021 11:39:25 +0000 (13:39 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 11 Oct 2021 12:10:07 +0000 (14:10 +0200)
The former is a macro for the latter, but let's use the official API
(the one that has an API).

src/basic/sparse-endian.h
src/libsystemd-network/dhcp-identifier.c
src/libsystemd-network/test-dhcp-client.c

index 9583dda9e5574fb076c25513dd99ed3d0d65157d..c795d3da8f2ff26188e4258322a3805d23f232e3 100644 (file)
@@ -55,9 +55,9 @@ typedef uint64_t __sd_bitwise be64_t;
 #undef le64toh
 
 #if __BYTE_ORDER == __LITTLE_ENDIAN
-#define bswap_16_on_le(x) __bswap_16(x)
-#define bswap_32_on_le(x) __bswap_32(x)
-#define bswap_64_on_le(x) __bswap_64(x)
+#define bswap_16_on_le(x) bswap_16(x)
+#define bswap_32_on_le(x) bswap_32(x)
+#define bswap_64_on_le(x) bswap_64(x)
 #define bswap_16_on_be(x) (x)
 #define bswap_32_on_be(x) (x)
 #define bswap_64_on_be(x) (x)
@@ -65,9 +65,9 @@ typedef uint64_t __sd_bitwise be64_t;
 #define bswap_16_on_le(x) (x)
 #define bswap_32_on_le(x) (x)
 #define bswap_64_on_le(x) (x)
-#define bswap_16_on_be(x) __bswap_16(x)
-#define bswap_32_on_be(x) __bswap_32(x)
-#define bswap_64_on_be(x) __bswap_64(x)
+#define bswap_16_on_be(x) bswap_16(x)
+#define bswap_32_on_be(x) bswap_32(x)
+#define bswap_64_on_be(x) bswap_64(x)
 #endif
 
 static inline le16_t htole16(uint16_t value) { return (le16_t __sd_force) bswap_16_on_be(value); }
index 3313e53f74ce47838dc1fd68508f9dac1b28d93f..23021f7bad8c38ccf8e6b9abfd2c47a25c3f75fb 100644 (file)
@@ -207,7 +207,7 @@ int dhcp_identifier_set_iaid(
         if (legacy_unstable_byteorder)
                 /* for historical reasons (a bug), the bits were swapped and thus
                  * the result was endianness dependent. Preserve that behavior. */
-                id32 = __bswap_32(id32);
+                id32 = bswap_32(id32);
         else
                 /* the fixed behavior returns a stable byte order. Since LE is expected
                  * to be more common, swap the bytes on LE to give the same as legacy
index 10db7f6c4bcde2d24c0b2c57553ee6b1145020c0..4428e54bc7878f9036fe9921de25306d4b78395d 100644 (file)
@@ -158,7 +158,7 @@ static void test_dhcp_identifier_set_iaid(void) {
 #if __BYTE_ORDER == __LITTLE_ENDIAN
         assert_se(iaid == iaid_legacy);
 #else
-        assert_se(iaid == __bswap_32(iaid_legacy));
+        assert_se(iaid == bswap_32(iaid_legacy));
 #endif
 }