summaryrefslogtreecommitdiff
path: root/strbuf.h
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2012-04-23 19:30:22 +0700
committerJunio C Hamano <gitster@pobox.com>2012-04-24 14:55:48 -0700
commit9a0a30aa4b92a69f63275680820b81c7e34629c9 (patch)
tree9eb2a29599ae9f2de250dfa7c11dad3d951428c7 /strbuf.h
parent1b8b2e4dc8fe2e4289ac47ffe55582f1afb67f0c (diff)
downloadgit-9a0a30aa4b92a69f63275680820b81c7e34629c9.tar.gz
strbuf: convenience format functions with \n automatically appended
These functions are helpful when we do not want to expose \n to translators. For example printf("hello world\n"); can be converted to printf_ln(_("hello world")); Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'strbuf.h')
-rw-r--r--strbuf.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/strbuf.h b/strbuf.h
index 3effaa86b6..b888d405db 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -99,6 +99,8 @@ __attribute__((format (printf,2,3)))
extern void strbuf_addf(struct strbuf *sb, const char *fmt, ...);
__attribute__((format (printf,2,0)))
extern void strbuf_vaddf(struct strbuf *sb, const char *fmt, va_list ap);
+__attribute__((format (printf,2,3)))
+extern void strbuf_addf_ln(struct strbuf *sb, const char *fmt, ...);
extern void strbuf_add_lines(struct strbuf *sb, const char *prefix, const char *buf, size_t size);
@@ -129,4 +131,9 @@ extern void strbuf_add_urlencode(struct strbuf *, const char *, size_t,
extern void strbuf_addstr_urlencode(struct strbuf *, const char *,
int reserved);
+__attribute__((format (printf,1,2)))
+extern int printf_ln(const char *fmt, ...);
+__attribute__((format (printf,2,3)))
+extern int fprintf_ln(FILE *fp, const char *fmt, ...);
+
#endif /* STRBUF_H */