From: Junio C Hamano <gitster@pobox.com>
To: karthik nayak <karthik.188@gmail.com>
Cc: Patrick Steinhardt <ps@pks.im>, git@vger.kernel.org
Subject: Re: [PATCH 06/10] reftable/generic: move generic iterator code into iterator interface
Date: Wed, 14 Aug 2024 09:24:42 -0700 [thread overview]
Message-ID: <xmqqh6bn1391.fsf@gitster.g> (raw)
In-Reply-To: <CAOLa=ZQ15h8bFRGGhzJUPNwkCrRmc2Y26n-0x+L_V_06xWgd7g@mail.gmail.com> (karthik nayak's message of "Tue, 13 Aug 2024 06:04:30 -0400")
karthik nayak <karthik.188@gmail.com> writes:
> Seems like the CI caught it too [1].
>
>> + it->ops->close(it->iter_arg);
>> + it->ops = NULL;
>> + FREE_AND_NULL(it->iter_arg);
>> +}
>> +
>
> [snip]
>
> [1]: https://gitlab.com/gitlab-org/git/-/jobs/7563308943
Looking at it, the suggestions the CI job makes look hit-and-miss.
For examle, this one
-static int stack_compact_range_stats(struct reftable_stack *st,
- size_t first, size_t last,
+static int stack_compact_range_stats(struct reftable_stack *st, size_t first,
+ size_t last,
struct reftable_log_expiry_config *config,
unsigned int flags)
is a degradation of readability. "first" and "last" pretty
much act as a pair and they read better sitting together next to
each other. The rewrite is reducing neither the total number of
lines or the maximum column width.
But this one
-static void write_n_ref_tables(struct reftable_stack *st,
- size_t n)
+static void write_n_ref_tables(struct reftable_stack *st, size_t n)
is certainly an improvement.
This one
struct reftable_record rec = {
.type = BLOCK_TYPE_REF,
- .u = {
- .ref = *ref
- },
+ .u = { .ref = *ref },
};
is hard to generalize but in this case it made a good suggestion.
If we _expect_ that we will enumerate more members of .u, then the
way originally written (plus trailing comma after the ".ref = *ref")
would be easier to maintain. But since .u is a union, we won't be
choosing more than one member to initialize by definition, so what
was suggested by the check-style linter is certainly much better.
Thanks.
next prev parent reply other threads:[~2024-08-14 16:24 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-13 6:24 [PATCH 00/10] reftable: drop generic `reftable_table` interface Patrick Steinhardt
2024-08-13 6:24 ` [PATCH 01/10] reftable/merged: expose functions to initialize iterators Patrick Steinhardt
2024-08-13 9:36 ` karthik nayak
2024-08-14 12:56 ` Patrick Steinhardt
2024-08-19 16:55 ` Justin Tobler
2024-08-20 12:00 ` Patrick Steinhardt
2024-08-13 6:24 ` [PATCH 02/10] reftable/merged: rename `reftable_new_merged_table()` Patrick Steinhardt
2024-08-13 6:24 ` [PATCH 03/10] reftable/merged: stop using generic tables in the merged table Patrick Steinhardt
2024-08-13 9:58 ` karthik nayak
2024-08-19 16:47 ` Justin Tobler
2024-08-13 6:24 ` [PATCH 04/10] reftable/stack: open-code reading refs Patrick Steinhardt
2024-08-13 6:24 ` [PATCH 05/10] reftable/iter: drop double-checking logic Patrick Steinhardt
2024-08-13 6:57 ` Eric Sunshine
2024-08-13 6:24 ` [PATCH 06/10] reftable/generic: move generic iterator code into iterator interface Patrick Steinhardt
2024-08-13 10:04 ` karthik nayak
2024-08-14 12:56 ` Patrick Steinhardt
2024-08-14 16:24 ` Junio C Hamano [this message]
2024-08-15 11:04 ` karthik nayak
2024-08-13 6:24 ` [PATCH 07/10] reftable/dump: drop unused `compact_stack()` Patrick Steinhardt
2024-08-13 6:24 ` [PATCH 08/10] reftable/dump: drop unused printing functionality Patrick Steinhardt
2024-08-13 10:14 ` karthik nayak
2024-08-14 12:56 ` Patrick Steinhardt
2024-08-13 6:24 ` [PATCH 09/10] reftable/dump: move code into "t/helper/test-reftable.c" Patrick Steinhardt
2024-08-13 6:24 ` [PATCH 10/10] reftable/generic: drop interface Patrick Steinhardt
2024-08-13 10:17 ` [PATCH 00/10] reftable: drop generic `reftable_table` interface karthik nayak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqh6bn1391.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=karthik.188@gmail.com \
--cc=ps@pks.im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.