From: Yu Watanabe Date: Sun, 16 Nov 2025 02:19:02 +0000 (+0900) Subject: tree-wide: swap arguments for streq() X-Git-Tag: v259-rc1~37^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a112c7646be3ea962a37f660a7099c34d993e9dc;p=thirdparty%2Fsystemd.git tree-wide: swap arguments for streq() We usually set a variable first, then constant. --- diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 4b33d918fce..b9c6ea6439c 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -4418,7 +4418,7 @@ int config_parse_io_limit( if (r < 0) return 0; - if (streq("infinity", p)) + if (streq(p, "infinity")) num = CGROUP_LIMIT_MAX; else { r = parse_size(p, 1000, &num); diff --git a/src/integritysetup/integritysetup.c b/src/integritysetup/integritysetup.c index 6bb3958fc6b..662d5a9b491 100644 --- a/src/integritysetup/integritysetup.c +++ b/src/integritysetup/integritysetup.c @@ -75,13 +75,13 @@ static const char *integrity_algorithm_select(const void *key_file_buf) { /* To keep a bit of sanity for end users, the subset of integrity algorithms we support will match what is used in integritysetup */ if (arg_integrity_algorithm) { - if (streq("hmac-sha256", arg_integrity_algorithm)) + if (streq(arg_integrity_algorithm, "hmac-sha256")) return DM_HMAC_256; - if (streq("hmac-sha512", arg_integrity_algorithm)) + if (streq(arg_integrity_algorithm, "hmac-sha512")) return DM_HMAC_512; - if (streq("phmac-sha256", arg_integrity_algorithm)) + if (streq(arg_integrity_algorithm, "phmac-sha256")) return DM_PHMAC_256; - if (streq("phmac-sha512", arg_integrity_algorithm)) + if (streq(arg_integrity_algorithm, "phmac-sha512")) return DM_PHMAC_512; return arg_integrity_algorithm; } else if (key_file_buf) diff --git a/src/libsystemd/sd-netlink/test-netlink.c b/src/libsystemd/sd-netlink/test-netlink.c index 2a7fb255b07..f127de7705c 100644 --- a/src/libsystemd/sd-netlink/test-netlink.c +++ b/src/libsystemd/sd-netlink/test-netlink.c @@ -383,14 +383,14 @@ TEST(message_container) { ASSERT_OK(sd_netlink_message_enter_container(m, IFLA_LINKINFO)); ASSERT_OK(sd_netlink_message_read_string(m, IFLA_INFO_KIND, &string_data)); - ASSERT_STREQ("vlan", string_data); + ASSERT_STREQ(string_data, "vlan"); ASSERT_OK(sd_netlink_message_enter_container(m, IFLA_INFO_DATA)); ASSERT_OK(sd_netlink_message_read_u16(m, IFLA_VLAN_ID, &u16_data)); ASSERT_OK(sd_netlink_message_exit_container(m)); ASSERT_OK(sd_netlink_message_read_string(m, IFLA_INFO_KIND, &string_data)); - ASSERT_STREQ("vlan", string_data); + ASSERT_STREQ(string_data, "vlan"); ASSERT_OK(sd_netlink_message_exit_container(m)); ASSERT_FAIL(sd_netlink_message_read_u32(m, IFLA_LINKINFO, &u32_data)); diff --git a/src/test/test-chase.c b/src/test/test-chase.c index 4f6e006d5e1..89705b4ffde 100644 --- a/src/test/test-chase.c +++ b/src/test/test-chase.c @@ -433,12 +433,12 @@ TEST(chase) { r = chase(p, NULL, CHASE_STEP, &result, NULL); assert_se(r == 0); - ASSERT_STREQ("/usr", result); + ASSERT_STREQ(result, "/usr"); result = mfree(result); r = chase("/usr", NULL, CHASE_STEP, &result, NULL); assert_se(r > 0); - ASSERT_STREQ("/usr", result); + ASSERT_STREQ(result, "/usr"); result = mfree(result); /* Make sure that symlinks in the "root" path are not resolved, but those below are */