Re: [PATCH 2/6] credential-store: move related functions to credential-store file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 02, 2023 at 09:14:50PM +0000, Calvin Wan wrote:

> is_rfc3986_unreserved() and is_rfc3986_reserved_or_unreserved() are only
> called from builtin/credential-store.c and they are only relevant to that
> file so move those functions and make them static.

This is probably OK to do, though I think "and they are only relevant to
that file" is overstating things a bit.

They are callbacks to be used with strbuf_add_urlencode(). Originally
they were static-locals next to that function, with a flag bit to
trigger which was used.

Later, c2694952e3 (strbuf: give URL-encoding API a char predicate fn,
2019-06-27) replaced the flag with a callback mechanism, which meant the
functions had to be public. But all callers except the new one added in
that series still needed them (that other caller is not encoding a URL,
so it wants different rules).

And then finally, 644de29e22 (http: drop support for curl < 7.19.4,
2021-07-30) dropped the http.c callers, leaving only the ones in
credential-store.

So yes, it's true that only credential-store.c needs them right now. But
separating them from strbuf_add_urlencode() is making that function next
to useless for any future callers, as they'd have to reimplement the
logic about which characters are reserved. I say "next to useless",
because that one "not a URL" caller doesn't need that logic.

So I dunno. It's largely academic until somebody else needs to encode
bits of a URL. But when they do, the first thing they'd need to do is
make these functions public again.

I think the main reason we do not have other callers is that urlmatch.c
implements its own percent-encoding code, and that's where we do most of
our URL handling. It does make me wonder if credential-store could
simply switch to using that, but that is probably out of scope for your
series.

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux