public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
To: Mike Frysinger <vapier@gentoo.org>
Cc: 'GNU C Library' <libc-alpha@sourceware.org>, nd <nd@arm.com>
Subject: Re: [PATCH] Use strlen when searching for a nul char
Date: Fri, 03 Jun 2016 12:38:00 -0000	[thread overview]
Message-ID: <DB3PR08MB00892E2120D9FBC5A88BD9AF83590@DB3PR08MB0089.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <AM3PR08MB0088881C0D8EB6F68365D1B783730@AM3PR08MB0088.eurprd08.prod.outlook.com>



ping

________________________________________
From: Wilco Dijkstra
Sent: 20 April 2016 15:50
To: Mike Frysinger
Cc: 'GNU C Library'; nd
Subject: Re: [PATCH] Use strlen when searching for a nul char

Mike Frysinger wrote:
> the issue isn't what version of gcc is used to build glibc.  this is an
> installed header, and we made guarantees that the installed headers work
> with much older versions of gcc at runtime.  those guarantees don't hard
> extend to pure-optimizations, but typically we wait much longer for those
> versions to cycle out of common use.  dropping code that requires gcc7
> (which doesn't even exist yet) doesn't fall into that bucket.

OK, here is the patch with the old define left in:

diff --git a/string/bits/string2.h b/string/bits/string2.h
index 80987602f34ded483854bcea86dabd5b81e42a18..62edc93b0f04249a504078caeee8fca192e91df8 100644
--- a/string/bits/string2.h
+++ b/string/bits/string2.h
@@ -60,13 +60,25 @@

 #ifndef _HAVE_STRING_ARCH_strchr
 extern void *__rawmemchr (const void *__s, int __c);
-#  define strchr(s, c) \
+# define strchr(s, c) \
   (__extension__ (__builtin_constant_p (c) && !__builtin_constant_p (s)              \
                  && (c) == '\0'                                              \
                  ? (char *) __rawmemchr (s, c)                               \
                  : __builtin_strchr (s, c)))
 #endif

+#ifndef _HAVE_STRING_ARCH_rawmemchr
+extern void *__rawmemchr (const void *__s, int __c);
+# define __rawmemchr(s, c) \
+    (__extension__ ({ char *__s = (char *)(s);         \
+      __builtin_constant_p (c) && (c) == '\0'          \
+      ? (void *)(__s + strlen (__s))                   \
+      : __rawmemchr (__s, (c));}))
+# ifdef __USE_GNU
+#  define rawmemchr(s,c) __rawmemchr ((s), (c))
+# endif
+#endif
+

 /* Copy SRC to DEST, returning pointer to final NUL byte.  */
 #ifdef __USE_GNU

  reply	other threads:[~2016-06-03 12:38 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-25 13:10 Wilco Dijkstra
2016-04-15 12:36 ` Wilco Dijkstra
2016-04-19 17:57 ` Mike Frysinger
2016-04-19 20:27   ` Adhemerval Zanella
2016-04-19 20:51     ` Mike Frysinger
2016-04-19 21:01       ` Adhemerval Zanella
2016-04-19 21:23         ` Mike Frysinger
2016-04-19 22:03   ` Wilco Dijkstra
2016-04-19 22:21     ` Mike Frysinger
2016-04-20 14:50       ` Wilco Dijkstra
2016-04-20 15:24         ` Mike Frysinger
2016-04-20 15:53           ` Wilco Dijkstra
2016-05-12 14:05         ` Wilco Dijkstra
2016-06-03 12:38           ` Wilco Dijkstra [this message]
2016-06-21 13:37             ` Wilco Dijkstra
2016-04-20 15:31       ` Wilco Dijkstra
  -- strict thread matches above, loose matches on Subject: below --
2015-10-07 14:30 Wilco Dijkstra
2015-10-07 14:46 ` pinskia
2015-10-07 14:50   ` Wilco Dijkstra
2015-10-07 15:20   ` Joseph Myers
2015-10-07 15:30     ` Andreas Schwab
2015-10-07 16:40     ` Wilco Dijkstra
2015-10-07 17:17       ` Joseph Myers

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=DB3PR08MB00892E2120D9FBC5A88BD9AF83590@DB3PR08MB0089.eurprd08.prod.outlook.com \
    --to=wilco.dijkstra@arm.com \
    --cc=libc-alpha@sourceware.org \
    --cc=nd@arm.com \
    --cc=vapier@gentoo.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).