grep-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] grep: make echo .|grep '\.' match once again


From: Jim Meyering
Subject: Re: [PATCH] grep: make echo .|grep '\.' match once again
Date: Fri, 18 Sep 2020 13:24:08 -0700

On Fri, Sep 18, 2020 at 1:09 PM Paul Eggert <eggert@cs.ucla.edu> wrote:
>
> Thanks for catching the bug that I introduced. I looked for a similar bug in
> update_patterns but it does the right thing.
>
> >        memcpy (keys, new_keys, p - new_keys);
> > +      /* We have just shortened this pattern.
> > +         Preserve the invariant that it is newline-terminated.  */
> > +      keys[*len_p] = '\n';
>
> This could be:
>
>      char *keys_end = mempcpy (keys, new_keys, p - new_keys);
>      *keys_end = '\n';
>
> to save a few instructions and arguably make it a bit clearer.

Good point. I prefer that, too. Will do (in an hour or two), unless
you get there first.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]