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