From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id B6ED13858413 for ; Thu, 17 Mar 2022 23:48:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B6ED13858413 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-594-q3YmWYmiNlCjwdX8EGZ28Q-1; Thu, 17 Mar 2022 19:48:01 -0400 X-MC-Unique: q3YmWYmiNlCjwdX8EGZ28Q-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1F7023C02196; Thu, 17 Mar 2022 23:48:01 +0000 (UTC) Received: from greed.delorie.com (ovpn-112-4.rdu2.redhat.com [10.10.112.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0BEDA401E75; Thu, 17 Mar 2022 23:48:01 +0000 (UTC) Received: from greed.delorie.com.redhat.com (localhost [127.0.0.1]) by greed.delorie.com (8.15.2/8.15.2) with ESMTP id 22HNm0Y21764375; Thu, 17 Mar 2022 19:48:00 -0400 From: DJ Delorie To: Siddhesh Poyarekar Cc: libc-alpha@sourceware.org Subject: Re: [PATCH 2/3] gai_init: Avoid jumping from if condition to its else counterpart In-Reply-To: <20220314173039.1060650-3-siddhesh@sourceware.org> (message from Siddhesh Poyarekar via Libc-alpha on Mon, 14 Mar 2022 23:00:38 +0530) Date: Thu, 17 Mar 2022 19:48:00 -0400 Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Mar 2022 23:48:05 -0000 Siddhesh Poyarekar via Libc-alpha writes: > Clean up another antipattern where code flows from an if condition to > its else counterpart with a goto. > > Most of the change in this patch is whitespace-only; a `git diff -b` > ought to show the actual logic changes. Re-diffed as "diff -EZdbwpU5" and reviewing that... LGTM Reviewed-by: DJ Delorie > --- before.txt 2022-03-17 19:42:35.903049857 -0400 > +++ after.txt 2022-03-17 19:42:49.976581858 -0400 > @@ -1834,12 +1834,13 @@ gaiconf_init (void) > struct scopelist *scopelist = NULL; > size_t nscopelist = 0; > bool scopelist_nullbits = false; > > FILE *fp = fopen (GAICONF_FNAME, "rce"); > + if (fp == NULL) > + goto no_file; > + > - if (fp != NULL) > - { Ok. > struct __stat64_t64 st; > if (__fstat64_time64 (fileno (fp), &st) != 0) > { > fclose (fp); > goto no_file; > @@ -2131,24 +2132,21 @@ gaiconf_init (void) > scopes = new_scopes; > if (oldscope != default_scopes) > free ((void *) oldscope); > > save_gaiconf_mtime (&st); > - } > - else > - { > + return; > + Ok. > no_file: > free_prefixlist (labellist); > free_prefixlist (precedencelist); > free_scopelist (scopelist); > > - /* If we previously read the file but it is gone now, free the > - old data and use the builtin one. Leave the reload flag > - alone. */ > + /* If we previously read the file but it is gone now, free the old data and > + use the builtin one. Leave the reload flag alone. */ > fini (); > } > -} Ok.