From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: [PATCH 1/2] use __strchrnul instead of strchr and strlen
Date: Tue, 2 Apr 2019 10:40:41 -0400 [thread overview]
Message-ID: <20190402144041.GL23599@brightrain.aerifal.cx> (raw)
In-Reply-To: <1508751505.10584787.1554199053330.JavaMail.zimbra@redhat.com>
On Tue, Apr 02, 2019 at 05:57:33AM -0400, Frediano Ziglio wrote:
> ping
Thanks for the ping. Applying!
Rich
> > The result is the same but takes less code.
> > Note that __execvpe calls getenv which calls __strchrnul so even
> > using static output the size of the executable won't grow.
> > ---
> > src/process/execvp.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/src/process/execvp.c b/src/process/execvp.c
> > index 1fdf036f..ef3b9dd5 100644
> > --- a/src/process/execvp.c
> > +++ b/src/process/execvp.c
> > @@ -28,8 +28,7 @@ int __execvpe(const char *file, char *const argv[], char
> > *const envp[])
> >
> > for(p=path; ; p=z) {
> > char b[l+k+1];
> > - z = strchr(p, ':');
> > - if (!z) z = p+strlen(p);
> > + z = __strchrnul(p, ':');
> > if (z-p >= l) {
> > if (!*z++) break;
> > continue;
prev parent reply other threads:[~2019-04-02 14:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-26 9:36 Frediano Ziglio
2019-03-26 9:36 ` [PATCH 2/2] avoid passing a parameter Frediano Ziglio
2019-03-26 15:07 ` Rich Felker
2019-03-26 15:22 ` Frediano Ziglio
2019-04-02 9:57 ` [PATCH 1/2] use __strchrnul instead of strchr and strlen Frediano Ziglio
2019-04-02 14:40 ` Rich Felker [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=20190402144041.GL23599@brightrain.aerifal.cx \
--to=dalias@libc.org \
--cc=musl@lists.openwall.com \
/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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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 NNTP newsgroup(s).