Skip to content

Commit 99c7de7

Browse files
committed
__attribute__: add a few missing format attributes
A public function mem_pool_strfmt() takes printf like parameters, but is not given an attribute as such. Also a few file-scope static functions were missing their format attribute. Add them. Signed-off-by: Junio C Hamano <[email protected]>
1 parent ba74464 commit 99c7de7

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

mem-pool.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ char *mem_pool_strndup(struct mem_pool *pool, const char *str, size_t len);
5050
/*
5151
* Allocate memory from the memory pool and format a string into it.
5252
*/
53+
__attribute__((format (printf, 2, 3)))
5354
char *mem_pool_strfmt(struct mem_pool *pool, const char *fmt, ...);
5455

5556
/*

scalar.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ static int unregister_dir(void)
289289
}
290290

291291
/* printf-style interface, expects `<key>=<value>` argument */
292+
__attribute__((format (printf, 1, 2)))
292293
static int set_config(const char *fmt, ...)
293294
{
294295
struct strbuf buf = STRBUF_INIT;

wt-status.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ void status_printf(struct wt_status *s, const char *color,
126126
va_end(ap);
127127
}
128128

129+
__attribute__((format (printf, 3, 4)))
129130
static void status_printf_more(struct wt_status *s, const char *color,
130131
const char *fmt, ...)
131132
{

0 commit comments

Comments
 (0)