From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Subject: [PATCH 03/13] log: drop unused "len" from show_tagger()
Date: Wed, 20 Mar 2019 04:14:01 -0400 [thread overview]
Message-ID: <20190320081400.GC10403@sigill.intra.peff.net> (raw)
In-Reply-To: <20190320081258.GA5621@sigill.intra.peff.net>
We pass the length of the found "tagger" line to show_tagger(), but it
does not use it; instead, it passes the string to pp_user_info(), which
reads until newline or NUL. This is OK for our purposes because we
always read the object contents into a buffer with an extra NUL (and
indeed, our sole caller already relies on this by using starts_with).
Let's drop the ignored parameter. And while we're touching the caller,
let's use skip_prefix() to avoid a magic number.
Signed-off-by: Jeff King <peff@peff.net>
---
builtin/log.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/builtin/log.c b/builtin/log.c
index 6595471ddf..35314d12ec 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -490,7 +490,7 @@ int cmd_whatchanged(int argc, const char **argv, const char *prefix)
return cmd_log_walk(&rev);
}
-static void show_tagger(char *buf, int len, struct rev_info *rev)
+static void show_tagger(const char *buf, struct rev_info *rev)
{
struct strbuf out = STRBUF_INIT;
struct pretty_print_context pp = {0};
@@ -546,11 +546,11 @@ static int show_tag_object(const struct object_id *oid, struct rev_info *rev)
assert(type == OBJ_TAG);
while (offset < size && buf[offset] != '\n') {
int new_offset = offset + 1;
+ const char *ident;
while (new_offset < size && buf[new_offset++] != '\n')
; /* do nothing */
- if (starts_with(buf + offset, "tagger "))
- show_tagger(buf + offset + 7,
- new_offset - offset - 7, rev);
+ if (skip_prefix(buf + offset, "tagger ", &ident))
+ show_tagger(ident, rev);
offset = new_offset;
}
--
2.21.0.701.g4401309e11
next prev parent reply other threads:[~2019-03-20 8:14 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-20 8:12 [PATCH 0/13] more unused parameter cleanups Jeff King
2019-03-20 8:13 ` [PATCH 01/13] revision: drop some unused "revs" parameters Jeff King
2019-03-20 8:13 ` [PATCH 02/13] log: drop unused rev_info from early output Jeff King
2019-03-20 8:14 ` Jeff King [this message]
2019-03-20 8:14 ` [PATCH 04/13] update-index: drop unused prefix_length parameter from do_reupdate() Jeff King
2019-03-20 8:14 ` [PATCH 05/13] test-date: drop unused "now" parameter from parse_dates() Jeff King
2019-03-20 8:15 ` [PATCH 06/13] unpack-trees: drop name_entry from traverse_by_cache_tree() Jeff King
2019-03-20 8:15 ` [PATCH 07/13] unpack-trees: drop unused error_type parameters Jeff King
2019-03-20 8:15 ` [PATCH 08/13] report_path_error(): drop unused prefix parameter Jeff King
2019-03-20 8:16 ` [PATCH 09/13] fetch_pack(): drop unused parameters Jeff King
2019-03-20 8:16 ` [PATCH 10/13] parse-options: drop unused ctx parameter from show_gitcomp() Jeff King
2019-03-20 8:16 ` [PATCH 11/13] pretty: drop unused "type" parameter in needs_rfc2047_encoding() Jeff King
2019-03-20 8:16 ` [PATCH 12/13] pretty: drop unused strbuf from parse_padding_placeholder() Jeff King
2019-03-20 8:16 ` [PATCH 13/13] parse_opt_ref_sorting: always use with NONEG flag Jeff King
2019-03-20 12:22 ` Martin Ågren
2019-03-20 20:22 ` Jeff King
2019-03-20 9:29 ` [PATCH 0/13] more unused parameter cleanups Junio C Hamano
2019-03-21 8:50 ` Ævar Arnfjörð Bjarmason
2019-03-21 9:44 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190320081400.GC10403@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).