diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2021-03-28 15:15:37 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-03-28 19:03:10 -0700 |
commit | 034a7b7bcc0ce5a7c3713173a1699ca8c9e722d5 (patch) | |
tree | 4b696f54ec5ee213c15061bd1a3d6b4df743740c /builtin/rev-parse.c | |
parent | fsck.c: rename variables in fsck_set_msg_type() for less confusion (diff) | |
download | tgif-034a7b7bcc0ce5a7c3713173a1699ca8c9e722d5.tar.xz |
fsck.c: remove (mostly) redundant append_msg_id() function
Remove the append_msg_id() function in favor of calling
prepare_msg_ids(). We already have code to compute the camel-cased
msg_id strings in msg_id_info, let's use it.
When the append_msg_id() function was added in 71ab8fa840f (fsck:
report the ID of the error/warning, 2015-06-22) the prepare_msg_ids()
function didn't exist. When prepare_msg_ids() was added in
a46baac61eb (fsck: factor out msg_id_info[] lazy initialization code,
2018-05-26) this code wasn't moved over to lazy initialization.
This changes the behavior of the code to initialize all the messages
instead of just camel-casing the one we need on the fly. Since the
common case is that we're printing just one message this is mostly
redundant work.
But that's OK in this case, reporting this fsck issue to the user
isn't performance-sensitive. If we were somehow doing so in a tight
loop (in a hopelessly broken repository?) this would help, since we'd
save ourselves from re-doing this work for identical messages, we
could just grab the prepared string from msg_id_info after the first
invocation.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/rev-parse.c')
0 files changed, 0 insertions, 0 deletions