gpg-interface: fix const-correctness of "eol" pointer

We accidentally shed the "const" of our buffer by passing it through memchr. Let's fix that, and while we're at it, move our variable declaration inside the loop, which is the only place that uses it. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Ben Toews <mastahyeti@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Apr 13, 2018 at 15:18 UTC 17ef3a421e0a1019592a0b14b95f09df61730071
1 file changed +1 -2
gpg-interface.c
+1 -2
@@ -103,11 +103,10 @@ void print_signature_buffer(const struct signature_check *sigc, unsigned flags)
103
104 size_t parse_signature(const char *buf, size_t size)
105 {
106 - char *eol;
106 size_t len = 0;
107 while (len < size && !starts_with(buf + len, PGP_SIGNATURE) &&
108 !starts_with(buf + len, PGP_MESSAGE)) {
110 - eol = memchr(buf + len, '\n', size - len);
109 + const char *eol = memchr(buf + len, '\n', size - len);
110 len += eol ? eol - (buf + len) + 1 : size - len;
111 }
112 return len;