This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Gcc builtin review: strchr, strrchr, strchrnul
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: libc-alpha at sourceware dot org
- Cc: Andrew Pinski <pinskia at gmail dot com>
- Date: Mon, 25 May 2015 14:16:34 +0200
- Subject: Gcc builtin review: strchr, strrchr, strchrnul
- Authentication-results: sourceware.org; auth=none
- References: <20150525101505 dot GA11233 at domone> <20150525114545 dot GC11233 at domone>
Then we have strchr, strrchr, strchrnul.
Aside from suggestion of replacing every strchr with strchrnul there are
missed optimizations of strchr(x,0) and strchrnul(x,0).
A strrchr(x,0) expands just to strchr(x,0) which is not enough as it
should do full expansion to x+strlen(x).
Then you miss case when x is constant as in wordexp.