Re: [PATCH 3/7] reftable/refname: refactor binary search over refnames
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Mar 25, 2024, 10:07 UTC
- Message-ID
- <ZgFM7Jw5y3JdImbE@tanuki>
- In-Reply-To
- <4ea7gnm5gbuvqnoyxdll3ccxxhr4bmlgzwpjtc7kqzbaf5juzb@5kwcy2qhblss>
On Fri, Mar 22, 2024 at 01:55:17PM -0500, Justin Tobler wrote:
Show 29 quoted lines
> On 24/03/22 01:22PM, Patrick Steinhardt wrote:
> > It is comparatively hard to understand how exactly the binary search
> > over refnames works given that the function and variable names are not
> > exactly easy to grasp. Rename them to make this more obvious. This
> > should not result in any change in behaviour.
> >
> > Signed-off-by: Patrick Steinhardt <ps@pks.im>
> > ---
> > reftable/refname.c | 44 ++++++++++++++++++++++----------------------
> > 1 file changed, 22 insertions(+), 22 deletions(-)
> >
> > diff --git a/reftable/refname.c b/reftable/refname.c
> > index 64eba1b886..9ec488d727 100644
> > --- a/reftable/refname.c
> > +++ b/reftable/refname.c
> > @@ -12,15 +12,15 @@
> > #include "refname.h"
> > #include "reftable-iterator.h"
> >
> > -struct find_arg {
> > - char **names;
> > - const char *want;
> > +struct refname_needle_lesseq_args {
> > + char **haystack;
> > + const char *needle;
> > };
>
> I agree that the previous `names` and `want` are a bit ambiguous. What
> do you think about `refnames` and `target_refname` instead?As said in the preceding commit I was rather aiming for consistency across the callsites, so I'll keep this as-is for now. I'm happy to be overruled though if others feel the same way.
Patrick