public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Florian Weimer <fw@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] resolv/tst-resolv-noaaaa: Support building for older C standards
Date: Fri, 24 Jun 2022 17:47:53 +0000 (GMT)	[thread overview]
Message-ID: <20220624174753.5EC62385626B@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=77536da3dea5af4d1859e4e754f07f47cf8d7d4c

commit 77536da3dea5af4d1859e4e754f07f47cf8d7d4c
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Jun 24 19:38:14 2022 +0200

    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);
               ^~~~

Diff:
---
 resolv/tst-resolv-noaaaa.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/resolv/tst-resolv-noaaaa.c b/resolv/tst-resolv-noaaaa.c
index 56b25f88a5..6e0c6b6fb8 100644
--- a/resolv/tst-resolv-noaaaa.c
+++ b/resolv/tst-resolv-noaaaa.c
@@ -71,14 +71,18 @@ response (const struct resolv_response_context *ctx,
       switch (qtype)
         {
         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;
 
         case T_PTR:
-          char *name = xasprintf ("ptr-%d", i);
-          resolv_response_add_name (b, name);
-          free (name);
+          {
+            char *name = xasprintf ("ptr-%d", i);
+            resolv_response_add_name (b, name);
+            free (name);
+          }
           break;
         }
       resolv_response_close_record (b);


                 reply	other threads:[~2022-06-24 17:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220624174753.5EC62385626B@sourceware.org \
    --to=fw@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).