f1dd77
commit 77536da3dea5af4d1859e4e754f07f47cf8d7d4c
f1dd77
Author: Florian Weimer <fweimer@redhat.com>
f1dd77
Date:   Fri Jun 24 19:38:14 2022 +0200
f1dd77
f1dd77
    resolv/tst-resolv-noaaaa: Support building for older C standards
f1dd77
    
f1dd77
    This avoids a compilation error:
f1dd77
    
f1dd77
    tst-resolv-noaaaa.c: In function 'response':
f1dd77
    tst-resolv-noaaaa.c:74:11: error: a label can only be part of a statement and a declaration is not a statement
f1dd77
               char ipv4[4] = {192, 0, 2, i + 1};
f1dd77
               ^~~~
f1dd77
    tst-resolv-noaaaa.c:79:11: error: a label can only be part of a statement and a declaration is not a statement
f1dd77
               char *name = xasprintf ("ptr-%d", i);
f1dd77
               ^~~~
f1dd77
f1dd77
diff --git a/resolv/tst-resolv-noaaaa.c b/resolv/tst-resolv-noaaaa.c
f1dd77
index 56b25f88a58ad286..6e0c6b6fb809e245 100644
f1dd77
--- a/resolv/tst-resolv-noaaaa.c
f1dd77
+++ b/resolv/tst-resolv-noaaaa.c
f1dd77
@@ -71,14 +71,18 @@ response (const struct resolv_response_context *ctx,
f1dd77
       switch (qtype)
f1dd77
         {
f1dd77
         case T_A:
f1dd77
-          char ipv4[4] = {192, 0, 2, i + 1};
f1dd77
-          resolv_response_add_data (b, &ipv4, sizeof (ipv4));
f1dd77
+          {
f1dd77
+            char ipv4[4] = {192, 0, 2, i + 1};
f1dd77
+            resolv_response_add_data (b, &ipv4, sizeof (ipv4));
f1dd77
+          }
f1dd77
           break;
f1dd77
 
f1dd77
         case T_PTR:
f1dd77
-          char *name = xasprintf ("ptr-%d", i);
f1dd77
-          resolv_response_add_name (b, name);
f1dd77
-          free (name);
f1dd77
+          {
f1dd77
+            char *name = xasprintf ("ptr-%d", i);
f1dd77
+            resolv_response_add_name (b, name);
f1dd77
+            free (name);
f1dd77
+          }
f1dd77
           break;
f1dd77
         }
f1dd77
       resolv_response_close_record (b);