From ac58c4c795455addd0d8f007e969d56e43f1165b Mon Sep 17 00:00:00 2001 From: Michael J Gruber Date: Wed, 10 Nov 2010 12:17:27 +0100 Subject: verify-tag: factor out signature detection into tag.h/c for later reuse and modification. Signed-off-by: Michael J Gruber Signed-off-by: Junio C Hamano --- builtin/verify-tag.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'builtin/verify-tag.c') diff --git a/builtin/verify-tag.c b/builtin/verify-tag.c index 9f482c29f51..86cac6d715d 100644 --- a/builtin/verify-tag.c +++ b/builtin/verify-tag.c @@ -17,13 +17,11 @@ static const char * const verify_tag_usage[] = { NULL }; -#define PGP_SIGNATURE "-----BEGIN PGP SIGNATURE-----" - static int run_gpg_verify(const char *buf, unsigned long size, int verbose) { struct child_process gpg; const char *args_gpg[] = {"gpg", "--verify", "FILE", "-", NULL}; - char path[PATH_MAX], *eol; + char path[PATH_MAX]; size_t len; int fd, ret; @@ -37,11 +35,7 @@ static int run_gpg_verify(const char *buf, unsigned long size, int verbose) close(fd); /* find the length without signature */ - len = 0; - while (len < size && prefixcmp(buf + len, PGP_SIGNATURE)) { - eol = memchr(buf + len, '\n', size - len); - len += eol ? eol - (buf + len) + 1 : size - len; - } + len = parse_signature(buf, size); if (verbose) write_in_full(1, buf, len); -- cgit v1.2.3