public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH COMMITTED] resolv: Replace __builtin_expect with __glibc_unlikely/__glibc_likely
Date: Wed, 19 Apr 2017 18:23:00 -0000	[thread overview]
Message-ID: <37ea776b-c538-967c-5b12-207fd69061df@redhat.com> (raw)
In-Reply-To: <87tw5k5vu4.fsf@linux-m68k.org>

[-- Attachment #1: Type: text/plain, Size: 573 bytes --]

On 04/19/2017 04:13 PM, Andreas Schwab wrote:
> On Apr 19 2017, fweimer@redhat.com (Florian Weimer) wrote:
> 
>> @@ -633,7 +633,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
>>   			packtmp, sizeof packtmp);
>>     if (n != -1 && __ns_name_ntop (packtmp, bp, linebuflen) == -1)
>>       {
>> -      if (__builtin_expect (errno, 0) == EMSGSIZE)
>> +      if (__glibc_unlikely (errno) == EMSGSIZE)
>              (__glibc_unlikely (errno == EMSGSIZE))

Ugh, I really didn't see this. :(

Fixed with the attached patch.

Thanks,
Florian


[-- Attachment #2: unlikely.patch --]
[-- Type: text/x-patch, Size: 734 bytes --]

nss_dns: Correct parentheses for the __glibc_unlikely argument

This fixes commit bee05c9d58a34ec5886faf3b56ecaa56355d94bf.

2017-04-19  Florian Weimer  <fweimer@redhat.com>

	* resolv/nss_dns/dns-host.c (getanswer_r): Fix parentheses.

diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index 7099d09..f121aa3 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -633,7 +633,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
 			packtmp, sizeof packtmp);
   if (n != -1 && __ns_name_ntop (packtmp, bp, linebuflen) == -1)
     {
-      if (__glibc_unlikely (errno) == EMSGSIZE)
+      if (__glibc_unlikely (errno == EMSGSIZE))
 	goto too_small;
 
       n = -1;


      reply	other threads:[~2017-04-19 18:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-19 12:31 Florian Weimer
2017-04-19 14:13 ` Andreas Schwab
2017-04-19 18:23   ` Florian Weimer [this message]

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=37ea776b-c538-967c-5b12-207fd69061df@redhat.com \
    --to=fweimer@redhat.com \
    --cc=libc-alpha@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).