diff options
author | Denton Liu <liu.denton@gmail.com> | 2019-11-20 03:51:16 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-11-20 07:33:36 +0300 |
commit | 3e8ed3b93e9b46eb6fe61589482751728865de57 (patch) | |
tree | d29ea483712d625311bc315c12197e5cb10be08c /pretty.c | |
parent | 4982516451ed4979bc7fc1a7f002fc310b060118 (diff) |
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 <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pretty.c')
-rw-r--r-- | pretty.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1612,14 +1612,14 @@ void repo_format_commit_message(struct repository *r, const char *format, struct strbuf *sb, const struct pretty_print_context *pretty_ctx) { - struct format_commit_context context; + struct format_commit_context context = { + .commit = commit, + .pretty_ctx = pretty_ctx, + .wrap_start = sb->len + }; const char *output_enc = pretty_ctx->output_encoding; const char *utf8 = "UTF-8"; - memset(&context, 0, sizeof(context)); - context.commit = commit; - context.pretty_ctx = pretty_ctx; - context.wrap_start = sb->len; /* * convert a commit message to UTF-8 first * as far as 'format_commit_item' assumes it in UTF-8 |