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: Paul Eggert
Subject: Re: [PATCH] grep: make echo .|grep '\.' match once again
Date: Fri, 18 Sep 2020 13:09:52 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

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.



reply via email to

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