]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: swap arguments for streq()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 16 Nov 2025 02:19:02 +0000 (11:19 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 16 Nov 2025 05:01:56 +0000 (14:01 +0900)
We usually set a variable first, then constant.

src/core/load-fragment.c
src/integritysetup/integritysetup.c
src/libsystemd/sd-netlink/test-netlink.c
src/test/test-chase.c

index 4b33d918fceb33e3ead6b68cd2e48509b4744ebe..b9c6ea6439c71a305fe8d59d40f969c1242ff866 100644 (file)
@@ -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);
index 6bb3958fc6b49db63dbc520e756a213c000fdf23..662d5a9b491603ce10b10d578ddf5158f07926d1 100644 (file)
@@ -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)
index 2a7fb255b0711e4ec6950df9d467225afb96bc95..f127de7705c22252b2de71c8aa63840aaf902898 100644 (file)
@@ -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));
index 4f6e006d5e1d4ae213b5011871ee4e62ade5dfee..89705b4ffdeafeb284e9630f6931aa9829693ef9 100644 (file)
@@ -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 */