summaryrefslogtreecommitdiff
path: root/strbuf.h
diff options
context:
space:
mode:
authorMatthew DeVore <matvore@google.com>2019-06-27 22:54:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-06-28 15:41:53 (GMT)
commitc2694952e33764818983fa247dcee72113c6ac6a (patch)
treef9566500dd09523b813a4b75072bb5fb52e7a202 /strbuf.h
parentcf9ceb5a12cad9c9153d227a0f497d1b522ce085 (diff)
downloadgit-c2694952e33764818983fa247dcee72113c6ac6a.zip
git-c2694952e33764818983fa247dcee72113c6ac6a.tar.gz
git-c2694952e33764818983fa247dcee72113c6ac6a.tar.bz2
strbuf: give URL-encoding API a char predicate fn
Allow callers to specify exactly what characters need to be URL-encoded and which do not. This new API will be taken advantage of in a patch later in this set. Helped-by: Jeff King <peff@peff.net> Signed-off-by: Matthew DeVore <matvore@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'strbuf.h')
-rw-r--r--strbuf.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/strbuf.h b/strbuf.h
index c8d98df..346d722 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -666,8 +666,13 @@ void strbuf_branchname(struct strbuf *sb, const char *name,
*/
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,
- int reserved);
+ char_predicate allow_unencoded_fn);
__attribute__((format (printf,1,2)))
int printf_ln(const char *fmt, ...);