[PATCH 18/22] strbuf.h: use the FORMATPRINTF macro to declare the gcc function attribute 'format printf'
- From
Elia Pinto <gitter.spiros@gmail.com>
- Date
- Feb 11, 2016, 12:38 UTC
- Message-ID
- <1455194339-859-19-git-send-email-gitter.spiros@gmail.com>
- In-Reply-To
- <1455194339-859-1-git-send-email-gitter.spiros@gmail.com>
Use the new FORMATPRINTF macro (in git-compat-util.h) to declare the gcc function attribute 'format printf'
Signed-off-by: Elia Pinto <gitter.spiros@gmail.com> --- strbuf.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/strbuf.h b/strbuf.h index f72fd14..c887dab 100644 --- a/strbuf.h +++ b/strbuf.h @@ -331,17 +331,17 @@ extern void strbuf_humanise_bytes(struct strbuf *buf, off_t bytes); /** * Add a formatted string to the buffer. */ -__attribute__((format (printf,2,3))) +FORMATPRINTF(2,3) extern void strbuf_addf(struct strbuf *sb, const char *fmt, ...); /** * Add a formatted string prepended by a comment character and a * blank to the buffer. */ -__attribute__((format (printf, 2, 3))) +FORMATPRINTF(2,3) extern void strbuf_commented_addf(struct strbuf *sb, const char *fmt, ...); -__attribute__((format (printf,2,0))) +FORMATPRINTF(2,0) extern void strbuf_vaddf(struct strbuf *sb, const char *fmt, va_list ap); /** @@ -556,9 +556,9 @@ extern int strbuf_check_branch_ref(struct strbuf *sb, const char *name); extern void strbuf_addstr_urlencode(struct strbuf *, const char *, int reserved); -__attribute__((format (printf,1,2))) +FORMATPRINTF(1,2) extern int printf_ln(const char *fmt, ...); -__attribute__((format (printf,2,3))) +FORMATPRINTF(2,3) extern int fprintf_ln(FILE *fp, const char *fmt, ...); char *xstrdup_tolower(const char *); @@ -567,9 +567,9 @@ char *xstrdup_tolower(const char *); * Create a newly allocated string using printf format. You can do this easily * with a strbuf, but this provides a shortcut to save a few lines. */ -__attribute__((format (printf, 1, 0))) +FORMATPRINTF(1,0) char *xstrvfmt(const char *fmt, va_list ap); -__attribute__((format (printf, 1, 2))) +FORMATPRINTF(1,2) char *xstrfmt(const char *fmt, ...); #endif /* STRBUF_H */
-- 2.5.0