Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalvin Wan <calvinwan@google.com>2023-06-06 22:48:40 +0300
committerJunio C Hamano <gitster@pobox.com>2023-06-12 23:49:36 +0300
commitf89854362cbe60371605dac3ae542109218ef1f3 (patch)
treed10fb2e212d6e5e618e485dd178b0a0f3fe861eb
parent5d1344b4973c8ea4904005f3bb51a47334ebb370 (diff)
credential-store: move related functions to credential-store file
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. Signed-off-by: Calvin Wan <calvinwan@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/credential-store.c19
-rw-r--r--strbuf.c19
-rw-r--r--strbuf.h3
3 files changed, 19 insertions, 22 deletions
diff --git a/builtin/credential-store.c b/builtin/credential-store.c
index 30c6ccf56c..5eea5bdb58 100644
--- a/builtin/credential-store.c
+++ b/builtin/credential-store.c
@@ -74,6 +74,25 @@ static void rewrite_credential_file(const char *fn, struct credential *c,
die_errno("unable to write credential store");
}
+static int is_rfc3986_unreserved(char ch)
+{
+ return isalnum(ch) ||
+ ch == '-' || ch == '_' || ch == '.' || ch == '~';
+}
+
+static int is_rfc3986_reserved_or_unreserved(char ch)
+{
+ if (is_rfc3986_unreserved(ch))
+ return 1;
+ switch (ch) {
+ case '!': case '*': case '\'': case '(': case ')': case ';':
+ case ':': case '@': case '&': case '=': case '+': case '$':
+ case ',': case '/': case '?': case '#': case '[': case ']':
+ return 1;
+ }
+ return 0;
+}
+
static void store_credential_file(const char *fn, struct credential *c)
{
struct strbuf buf = STRBUF_INIT;
diff --git a/strbuf.c b/strbuf.c
index a2249ae7ed..5244029d91 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -810,25 +810,6 @@ void strbuf_addstr_xml_quoted(struct strbuf *buf, const char *s)
}
}
-int is_rfc3986_reserved_or_unreserved(char ch)
-{
- if (is_rfc3986_unreserved(ch))
- return 1;
- switch (ch) {
- case '!': case '*': case '\'': case '(': case ')': case ';':
- case ':': case '@': case '&': case '=': case '+': case '$':
- case ',': case '/': case '?': case '#': case '[': case ']':
- return 1;
- }
- return 0;
-}
-
-int is_rfc3986_unreserved(char ch)
-{
- return isalnum(ch) ||
- ch == '-' || ch == '_' || ch == '.' || ch == '~';
-}
-
static void strbuf_add_urlencode(struct strbuf *sb, const char *s, size_t len,
char_predicate allow_unencoded_fn)
{
diff --git a/strbuf.h b/strbuf.h
index 207efb4f98..114ad0c024 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -690,9 +690,6 @@ int strbuf_check_branch_ref(struct strbuf *sb, const char *name);
typedef int (*char_predicate)(char ch);
-int is_rfc3986_unreserved(char ch);
-int is_rfc3986_reserved_or_unreserved(char ch);
-
void strbuf_addstr_urlencode(struct strbuf *sb, const char *name,
char_predicate allow_unencoded_fn);