grep: mark "haystack" buffers as const
commit1a845fbc48f2613c0daab717ee934e066e65723d
authorJeff King <peff@peff.net>
Tue, 21 Sep 2021 03:49:49 +0000 (20 23:49 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 22 Sep 2021 18:59:50 +0000 (22 11:59 -0700)
tree610f0b29ca3dd55842b3ca097c812aa2cecff012
parentf84e79ff4bffbcd9de85adc270f5164a6b024d34
grep: mark "haystack" buffers as const

When we're grepping in a buffer, we don't need to modify it. So we can
take "const char *" buffers, rather than "char *". This can avoid some
awkward casts in our callers, and make our expectations more clear (we
will not take ownership of the memory, nor will we ever write to it).

These spots don't all necessarily have to be converted at the same time,
but some of them are dependent on others, because we pass
pointers-to-pointers in a few cases. And none of this should change any
behavior, since we're just adding "const" qualifiers (and likewise, the
compiler will let us know if we missed any spots). So it's relatively
low-risk to just do this all at once.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
grep.c