summaryrefslogtreecommitdiff
path: root/builtin/log.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2019-03-20 08:14:01 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-03-20 09:34:09 (GMT)
commitaf117077d38af01f585adb16ded9deccb559b0b6 (patch)
tree52d7b87c06dca7ab2abad1e7de4c21450164c870 /builtin/log.c
parent7954d365c64fd5cb854cf477aab3c12b8ff43f42 (diff)
downloadgit-af117077d38af01f585adb16ded9deccb559b0b6.zip
git-af117077d38af01f585adb16ded9deccb559b0b6.tar.gz
git-af117077d38af01f585adb16ded9deccb559b0b6.tar.bz2
log: drop unused "len" from show_tagger()
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/log.c')
-rw-r--r--builtin/log.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/builtin/log.c b/builtin/log.c
index 6595471..35314d1 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;
}