1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-07 06:43:00 +03:00

resolv/tst-resolv-noaaaa: Support building for older C standards

This avoids a compilation error:

tst-resolv-noaaaa.c: In function 'response':
tst-resolv-noaaaa.c:74:11: error: a label can only be part of a statement and a declaration is not a statement
           char ipv4[4] = {192, 0, 2, i + 1};
           ^~~~
tst-resolv-noaaaa.c:79:11: error: a label can only be part of a statement and a declaration is not a statement
           char *name = xasprintf ("ptr-%d", i);
           ^~~~
This commit is contained in:
Florian Weimer
2022-06-24 19:38:14 +02:00
parent f282cdbe7f
commit 77536da3de

View File

@@ -71,14 +71,18 @@ response (const struct resolv_response_context *ctx,
switch (qtype) switch (qtype)
{ {
case T_A: case T_A:
char ipv4[4] = {192, 0, 2, i + 1}; {
resolv_response_add_data (b, &ipv4, sizeof (ipv4)); char ipv4[4] = {192, 0, 2, i + 1};
resolv_response_add_data (b, &ipv4, sizeof (ipv4));
}
break; break;
case T_PTR: case T_PTR:
char *name = xasprintf ("ptr-%d", i); {
resolv_response_add_name (b, name); char *name = xasprintf ("ptr-%d", i);
free (name); resolv_response_add_name (b, name);
free (name);
}
break; break;
} }
resolv_response_close_record (b); resolv_response_close_record (b);