]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-dhcp-option: rename variable to avoid global/local name conflict
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 8 Dec 2021 09:06:49 +0000 (10:06 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 8 Dec 2021 09:13:44 +0000 (10:13 +0100)
CodeQL was complaining that the local variable obscurs the global
one. It is indeed a bit confusing when reading this… Let's rename
the variable to avoid confusing the reader.

src/libsystemd-network/test-dhcp-option.c

index c4a0d4ccb2696c68eb416bb2847cd5ae46cb4596..2c82ac982dfcd8920dbfa406d444e208c51b6e21 100644 (file)
@@ -278,7 +278,7 @@ static void test_option_removal(struct option_desc *desc) {
         assert_se(dhcp_option_parse(message, sizeof(DHCPMessage) + desc->len, NULL, NULL, NULL) < 0);
 }
 
-static uint8_t options[64] = {
+static uint8_t the_options[64] = {
         'A', 'B', 'C', 'D',
         160, 2, 0x11, 0x12,
         0,
@@ -316,16 +316,16 @@ static void test_option_set(void) {
 
         offset = pos = 4;
         len = 11;
-        while (pos < len && options[pos] != SD_DHCP_OPTION_END) {
+        while (pos < len && the_options[pos] != SD_DHCP_OPTION_END) {
                 assert_se(dhcp_option_append(result, len, &offset, DHCP_OVERLOAD_SNAME,
-                                             options[pos],
-                                             options[pos + 1],
-                                             &options[pos + 2]) >= 0);
+                                             the_options[pos],
+                                             the_options[pos + 1],
+                                             &the_options[pos + 2]) >= 0);
 
-                if (options[pos] == SD_DHCP_OPTION_PAD)
+                if (the_options[pos] == SD_DHCP_OPTION_PAD)
                         pos++;
                 else
-                        pos += 2 + options[pos + 1];
+                        pos += 2 + the_options[pos + 1];
 
                 if (pos < len)
                         assert_se(offset == pos);
@@ -334,8 +334,8 @@ static void test_option_set(void) {
         for (i = 0; i < 9; i++) {
                 if (verbose)
                         printf("%2u: 0x%02x(0x%02x) (options)\n", i, result->options[i],
-                               options[i]);
-                assert_se(result->options[i] == options[i]);
+                               the_options[i]);
+                assert_se(result->options[i] == the_options[i]);
         }
 
         if (verbose)
@@ -353,8 +353,8 @@ static void test_option_set(void) {
         for (i = 0; i < pos - 8; i++) {
                 if (verbose)
                         printf("%2u: 0x%02x(0x%02x) (sname)\n", i, result->sname[i],
-                               options[i + 9]);
-                assert_se(result->sname[i] == options[i + 9]);
+                               the_options[i + 9]);
+                assert_se(result->sname[i] == the_options[i + 9]);
         }
 
         if (verbose)