Skip to content

Commit af11707

Browse files
peffgitster
authored andcommitted
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>
1 parent 7954d36 commit af11707

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

builtin/log.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ int cmd_whatchanged(int argc, const char **argv, const char *prefix)
490490
return cmd_log_walk(&rev);
491491
}
492492

493-
static void show_tagger(char *buf, int len, struct rev_info *rev)
493+
static void show_tagger(const char *buf, struct rev_info *rev)
494494
{
495495
struct strbuf out = STRBUF_INIT;
496496
struct pretty_print_context pp = {0};
@@ -546,11 +546,11 @@ static int show_tag_object(const struct object_id *oid, struct rev_info *rev)
546546
assert(type == OBJ_TAG);
547547
while (offset < size && buf[offset] != '\n') {
548548
int new_offset = offset + 1;
549+
const char *ident;
549550
while (new_offset < size && buf[new_offset++] != '\n')
550551
; /* do nothing */
551-
if (starts_with(buf + offset, "tagger "))
552-
show_tagger(buf + offset + 7,
553-
new_offset - offset - 7, rev);
552+
if (skip_prefix(buf + offset, "tagger ", &ident))
553+
show_tagger(ident, rev);
554554
offset = new_offset;
555555
}
556556

0 commit comments

Comments
 (0)