From: "Carlo Marcelo Arenas Belón" <carenas@gmail.com>
To: git@vger.kernel.org
Cc: sandals@crustytoothpaste.net,
"Carlo Marcelo Arenas Belón" <carenas@gmail.com>
Subject: [PATCH] credential: remove unnecessary forward declarations
Date: Fri, 24 Apr 2020 04:23:56 -0700 [thread overview]
Message-ID: <20200424112356.74165-1-carenas@gmail.com> (raw)
46fd7b3900 (credential: allow wildcard patterns when matching config,
2020-02-20) introduced a forward declaration for credential_describe()
that wasn't needed as well as a forward declaration for a similar
function that was implemented a few lines below.
remove the unnecessary forward declarations by moving the function
to where it is needed instead.
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
credential.c | 37 +++++++++++++++++--------------------
1 file changed, 17 insertions(+), 20 deletions(-)
diff --git a/credential.c b/credential.c
index 064e25e5d5..24eabe8929 100644
--- a/credential.c
+++ b/credential.c
@@ -73,15 +73,29 @@ static int proto_is_http(const char *s)
return !strcmp(s, "https") || !strcmp(s, "http");
}
-static void credential_describe(struct credential *c, struct strbuf *out);
-static void credential_format(struct credential *c, struct strbuf *out);
-
static int select_all(const struct urlmatch_item *a,
const struct urlmatch_item *b)
{
return 0;
}
+static void credential_format(struct credential *c, struct strbuf *out)
+{
+ if (!c->protocol)
+ return;
+ strbuf_addf(out, "%s://", c->protocol);
+ if (c->username && *c->username) {
+ strbuf_add_percentencode(out, c->username);
+ strbuf_addch(out, '@');
+ }
+ if (c->host)
+ strbuf_addstr(out, c->host);
+ if (c->path) {
+ strbuf_addch(out, '/');
+ strbuf_add_percentencode(out, c->path);
+ }
+}
+
static void credential_apply_config(struct credential *c)
{
char *normalized_url;
@@ -130,23 +144,6 @@ static void credential_describe(struct credential *c, struct strbuf *out)
strbuf_addf(out, "/%s", c->path);
}
-static void credential_format(struct credential *c, struct strbuf *out)
-{
- if (!c->protocol)
- return;
- strbuf_addf(out, "%s://", c->protocol);
- if (c->username && *c->username) {
- strbuf_add_percentencode(out, c->username);
- strbuf_addch(out, '@');
- }
- if (c->host)
- strbuf_addstr(out, c->host);
- if (c->path) {
- strbuf_addch(out, '/');
- strbuf_add_percentencode(out, c->path);
- }
-}
-
static char *credential_ask_one(const char *what, struct credential *c,
int flags)
{
--
2.26.2.569.g1d74ac4d14
next reply other threads:[~2020-04-24 11:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-24 11:23 Carlo Marcelo Arenas Belón [this message]
2020-04-24 20:26 ` [PATCH] credential: remove unnecessary forward declarations Junio C Hamano
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=20200424112356.74165-1-carenas@gmail.com \
--to=carenas@gmail.com \
--cc=git@vger.kernel.org \
--cc=sandals@crustytoothpaste.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).