Thread (30 messages) 30 messages, 7 authors, 2021-09-24

Re: [PATCH 0/5] const-correctness in grep.c

flat view

From: Taylor Blau <hidden>
Date: 2021-09-21 04:30:45

On Mon, Sep 20, 2021 at 11:45:42PM -0400, Jeff King wrote:
While discussing [1], I noticed that the grep code mostly takes
non-const buffers, even though it is conceptually a read-only operation
to search in them. The culprit is a handful of spots that temporarily
tie off NUL-terminated strings by overwriting a byte of the buffer and
then restoring it. But I think we no longer need to do so these days,
now that we have a regexec_buf() that can take a ptr/size pair.
This all looks very reasonable to me. I appreciated the way you broke up
each spot that unnecessarily modified a buffer into its own patch with
its own explanation.

I looked through each of the three spots you mentioned with a close eye
and concurred with your reasoning. (To the extent it was possible, I
tried to ignore most of your commentary until I had generated my own
understanding while searching through my copy of grep.c).

Thanks for an enjoyable set of patches to read.

    Reviewed-by: Taylor Blau [off-list ref]
[1] https://lore.kernel.org/git/YUk3zwuse56v76ze@coredump.intra.peff.net/ (local)
Thanks,
Taylor
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help