Skip to content

Commit 3548701

Browse files
Tarmigan Caseboltgitster
authored andcommitted
http-backend: Let gcc check the format of more printf-type functions.
We already have these checks in many printf-type functions that have prototypes which are in header files. Add these same checks to static functions in http-backend.c Signed-off-by: Tarmigan Casebolt <[email protected]> Acked-by: Shawn O. Pearce <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 48aec1b commit 3548701

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

http-backend.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ static const char *get_parameter(const char *name)
108108
return i ? i->util : NULL;
109109
}
110110

111+
__attribute__((format (printf, 2, 3)))
111112
static void format_write(int fd, const char *fmt, ...)
112113
{
113114
static char buffer[1024];
@@ -165,6 +166,7 @@ static void end_headers(void)
165166
safe_write(1, "\r\n", 2);
166167
}
167168

169+
__attribute__((format (printf, 1, 2)))
168170
static NORETURN void not_found(const char *err, ...)
169171
{
170172
va_list params;
@@ -180,6 +182,7 @@ static NORETURN void not_found(const char *err, ...)
180182
exit(0);
181183
}
182184

185+
__attribute__((format (printf, 1, 2)))
183186
static NORETURN void forbidden(const char *err, ...)
184187
{
185188
va_list params;

0 commit comments

Comments
 (0)