Skip to content

Commit 3e8ed3b

Browse files
Denton-Lgitster
authored andcommitted
pretty.c: inline initalize format_context
Instead of memsetting and then initializing the fields in the struct, move the initialization of `format_context` to its assignment. Signed-off-by: Denton Liu <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4982516 commit 3e8ed3b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pretty.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,14 +1612,14 @@ void repo_format_commit_message(struct repository *r,
16121612
const char *format, struct strbuf *sb,
16131613
const struct pretty_print_context *pretty_ctx)
16141614
{
1615-
struct format_commit_context context;
1615+
struct format_commit_context context = {
1616+
.commit = commit,
1617+
.pretty_ctx = pretty_ctx,
1618+
.wrap_start = sb->len
1619+
};
16161620
const char *output_enc = pretty_ctx->output_encoding;
16171621
const char *utf8 = "UTF-8";
16181622

1619-
memset(&context, 0, sizeof(context));
1620-
context.commit = commit;
1621-
context.pretty_ctx = pretty_ctx;
1622-
context.wrap_start = sb->len;
16231623
/*
16241624
* convert a commit message to UTF-8 first
16251625
* as far as 'format_commit_item' assumes it in UTF-8

0 commit comments

Comments
 (0)