initrd/tests: avoid variable declaration in for loop in test_if_off()

src/core/initrd/tests/test-cmdline-reader.c: In function test_if_off:
    src/core/initrd/tests/test-cmdline-reader.c:564:5: error: for loop initial declarations are only allowed in C99 mode
        for (int i = 0; i < G_N_ELEMENTS(conn_expected); ++i) {
        ^
    src/core/initrd/tests/test-cmdline-reader.c:564:5: note: use option -std=c99 or -std=gnu99 to compile your code
This commit is contained in:
Thomas Haller 2021-03-15 10:15:43 +01:00
parent c96a21e3cf
commit 0d856432b7
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -549,7 +549,6 @@ test_if_off(void)
const char name[32];
const char ipv4_method[32];
const char ipv6_method[32];
} conn_expected[] = {
{"default_connection",
NM_SETTING_IP4_CONFIG_METHOD_DISABLED,
@ -558,11 +557,12 @@ test_if_off(void)
{"ens4", NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NM_SETTING_IP6_CONFIG_METHOD_DISABLED},
{"ens5", NM_SETTING_IP4_CONFIG_METHOD_DISABLED, NM_SETTING_IP6_CONFIG_METHOD_MANUAL},
};
guint i;
connections = _parse_cons(ARGV);
g_assert_cmpint(g_hash_table_size(connections), ==, G_N_ELEMENTS(conn_expected));
for (int i = 0; i < G_N_ELEMENTS(conn_expected); ++i) {
for (i = 0; i < G_N_ELEMENTS(conn_expected); i++) {
connection = g_hash_table_lookup(connections, conn_expected[i].name);
nmtst_assert_connection_verifies_without_normalization(connection);