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:
Diffstat (limited to 'strbuf.c')
-rw-r--r--strbuf.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/strbuf.c b/strbuf.c
index 5427cfdc65..4b9e30cadc 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -447,8 +447,8 @@ static int is_rfc3986_unreserved(char ch)
ch == '-' || ch == '_' || ch == '.' || ch == '~';
}
-void strbuf_add_urlencode(struct strbuf *sb, const char *s, size_t len,
- int reserved)
+static void strbuf_add_urlencode(struct strbuf *sb, const char *s, size_t len,
+ int reserved)
{
strbuf_grow(sb, len);
while (len--) {
@@ -466,3 +466,27 @@ void strbuf_addstr_urlencode(struct strbuf *sb, const char *s,
{
strbuf_add_urlencode(sb, s, strlen(s), reserved);
}
+
+int printf_ln(const char *fmt, ...)
+{
+ int ret;
+ va_list ap;
+ va_start(ap, fmt);
+ ret = vprintf(fmt, ap);
+ va_end(ap);
+ if (ret < 0 || putchar('\n') == EOF)
+ return -1;
+ return ret + 1;
+}
+
+int fprintf_ln(FILE *fp, const char *fmt, ...)
+{
+ int ret;
+ va_list ap;
+ va_start(ap, fmt);
+ ret = vfprintf(fp, fmt, ap);
+ va_end(ap);
+ if (ret < 0 || putc('\n', fp) == EOF)
+ return -1;
+ return ret + 1;
+}