git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v4 4/6] tag.c: Replace varialbe name for readability

From
santiago@nyu.edu <santiago@nyu.edu>
Date
Apr 4, 2016, 22:22 UTC
Message-ID
<1459808535-8895-5-git-send-email-santiago@nyu.edu>
In-Reply-To
<1459808535-8895-1-git-send-email-santiago@nyu.edu>
From: Santiago Torres <santiago@nyu.edu>

The run_gpg_verify function has two variables size, and len. This may come off as confusing when reading the code. We clarify which one pertains to the length of the tag headers by renaming len to payload_length.

Signed-off-by: Santiago Torres <santiago@nyu.edu>
---
	Note: this used to be part of the previous patch on v3. I moved the
renaming part to a single patch to simplify the review. 
 tag.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/tag.c b/tag.c
index 81e86e6..f6443db 100644
--- a/tag.c
+++ b/tag.c
@@ -9,20 +9,21 @@ const char *tag_type = "tag";
 static int run_gpg_verify(const char *buf, unsigned long size, unsigned flags)
 {
 	struct signature_check sigc;
-	int len;
+	int payload_length;
 	int ret;
 
 	memset(&sigc, 0, sizeof(sigc));
 
-	len = parse_signature(buf, size);
+	payload_length = parse_signature(buf, size);
 
-	if (size == len) {
+	if (size == payload_length) {
 		if (flags & GPG_VERIFY_VERBOSE)
-			write_in_full(1, buf, len);
+			write_in_full(1, buf, payload_length);
 		return error("no signature found");
        }
 
-	ret = check_signature(buf, len, buf + len, size - len, &sigc);
+	ret = check_signature(buf, payload_length, buf + payload_length,
+				size - payload_length, &sigc);
 	print_signature_buffer(&sigc, flags);
 
 	signature_check_clear(&sigc);
-- 
2.8.0
Previous: santiago@nyu.eduNext: Eric Sunshine
Message 8 of 16 in “tag: move PGP verification code to tag.c”
  1. 0/6 tag: move PGP verification code to tag.csantiago@nyu.edu, Apr 4, 2016
  2. 1/6 builtin/verify-tag.c: Ignore SIGPIPE on gpg-interfacesantiago@nyu.edu, Apr 4, 2016
  3. 2/6 t/t7030-verify-tag.sh: Adds validation for multiple tagssantiago@nyu.edu, Apr 4, 2016
  4. Eric SunshineApr 5, 2016
  5. Santiago TorresApr 5, 2016
  6. Eric SunshineApr 5, 2016
  7. 3/6 builtin/verify-tag: move verification code to tag.csantiago@nyu.edu, Apr 4, 2016
  8. 4/6 tag.c: Replace varialbe name for readabilitysantiago@nyu.edu, Apr 4, 2016
  9. Eric SunshineApr 5, 2016
  10. 5/6 tag: use pgp_verify_function in tag -v callsantiago@nyu.edu, Apr 4, 2016
  11. Eric SunshineApr 5, 2016
  12. Santiago TorresApr 5, 2016
  13. 6/6 tag.c: Change gpg_verify_tag argument to sha1santiago@nyu.edu, Apr 4, 2016
  14. Eric SunshineApr 5, 2016
  15. Santiago TorresApr 5, 2016
  16. Eric SunshineApr 5, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.