1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-08 21:17:47 +03:00

test-dhcp-option: rename variable to avoid global/local name conflict

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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-12-08 10:06:49 +01:00
parent dcd9d196a4
commit 74e2e54896

View 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)