зеркало из https://github.com/microsoft/git.git
Merge branch 'tc/format-attribute'
* tc/format-attribute: Check the format of more printf-type functions
This commit is contained in:
Коммит
82f05d5dd7
|
@ -47,6 +47,7 @@ static void objreport(struct object *obj, const char *severity,
|
|||
fputs("\n", stderr);
|
||||
}
|
||||
|
||||
__attribute__((format (printf, 2, 3)))
|
||||
static int objerror(struct object *obj, const char *err, ...)
|
||||
{
|
||||
va_list params;
|
||||
|
@ -57,6 +58,7 @@ static int objerror(struct object *obj, const char *err, ...)
|
|||
return -1;
|
||||
}
|
||||
|
||||
__attribute__((format (printf, 3, 4)))
|
||||
static int fsck_error_func(struct object *obj, int type, const char *err, ...)
|
||||
{
|
||||
va_list params;
|
||||
|
|
|
@ -27,6 +27,7 @@ static int mark_valid_only;
|
|||
#define MARK_VALID 1
|
||||
#define UNMARK_VALID 2
|
||||
|
||||
__attribute__((format (printf, 1, 2)))
|
||||
static void report(const char *fmt, ...)
|
||||
{
|
||||
va_list vp;
|
||||
|
|
|
@ -67,6 +67,7 @@ static int run_upload_archive(int argc, const char **argv, const char *prefix)
|
|||
return write_archive(sent_argc, sent_argv, prefix, 0);
|
||||
}
|
||||
|
||||
__attribute__((format (printf, 1, 2)))
|
||||
static void error_clnt(const char *fmt, ...)
|
||||
{
|
||||
char buf[1024];
|
||||
|
|
2
cache.h
2
cache.h
|
@ -967,7 +967,9 @@ extern void *alloc_object_node(void);
|
|||
extern void alloc_report(void);
|
||||
|
||||
/* trace.c */
|
||||
__attribute__((format (printf, 1, 2)))
|
||||
extern void trace_printf(const char *format, ...);
|
||||
__attribute__((format (printf, 2, 3)))
|
||||
extern void trace_argv_printf(const char **argv, const char *format, ...);
|
||||
|
||||
/* convert.c */
|
||||
|
|
2
color.h
2
color.h
|
@ -29,7 +29,9 @@ int git_color_default_config(const char *var, const char *value, void *cb);
|
|||
int git_config_colorbool(const char *var, const char *value, int stdout_is_tty);
|
||||
void color_parse(const char *value, const char *var, char *dst);
|
||||
void color_parse_mem(const char *value, int len, const char *var, char *dst);
|
||||
__attribute__((format (printf, 3, 4)))
|
||||
int color_fprintf(FILE *fp, const char *color, const char *fmt, ...);
|
||||
__attribute__((format (printf, 3, 4)))
|
||||
int color_fprintf_ln(FILE *fp, const char *color, const char *fmt, ...);
|
||||
int color_fwrite_lines(FILE *fp, const char *color, size_t count, const char *buf);
|
||||
|
||||
|
|
2
daemon.c
2
daemon.c
|
@ -77,6 +77,7 @@ static void logreport(int priority, const char *err, va_list params)
|
|||
}
|
||||
}
|
||||
|
||||
__attribute__((format (printf, 1, 2)))
|
||||
static void logerror(const char *err, ...)
|
||||
{
|
||||
va_list params;
|
||||
|
@ -85,6 +86,7 @@ static void logerror(const char *err, ...)
|
|||
va_end(params);
|
||||
}
|
||||
|
||||
__attribute__((format (printf, 1, 2)))
|
||||
static void loginfo(const char *err, ...)
|
||||
{
|
||||
va_list params;
|
||||
|
|
1
fsck.h
1
fsck.h
|
@ -17,6 +17,7 @@ typedef int (*fsck_walk_func)(struct object *obj, int type, void *data);
|
|||
/* callback for fsck_object, type is FSCK_ERROR or FSCK_WARN */
|
||||
typedef int (*fsck_error)(struct object *obj, int type, const char *err, ...);
|
||||
|
||||
__attribute__((format (printf, 3, 4)))
|
||||
int fsck_error_function(struct object *obj, int type, const char *fmt, ...);
|
||||
|
||||
/* descend in all linked child objects
|
||||
|
|
|
@ -104,13 +104,16 @@ static const char imap_send_usage[] = "git imap-send < <mbox>";
|
|||
|
||||
static int Verbose, Quiet;
|
||||
|
||||
__attribute__((format (printf, 1, 2)))
|
||||
static void imap_info(const char *, ...);
|
||||
__attribute__((format (printf, 1, 2)))
|
||||
static void imap_warn(const char *, ...);
|
||||
|
||||
static char *next_arg(char **);
|
||||
|
||||
static void free_generic_messages(struct message *);
|
||||
|
||||
__attribute__((format (printf, 3, 4)))
|
||||
static int nfsnprintf(char *buf, int blen, const char *fmt, ...);
|
||||
|
||||
static int nfvasprintf(char **strp, const char *fmt, va_list ap)
|
||||
|
@ -562,6 +565,7 @@ static struct imap_cmd *v_issue_imap_cmd(struct imap_store *ctx,
|
|||
return cmd;
|
||||
}
|
||||
|
||||
__attribute__((format (printf, 3, 4)))
|
||||
static struct imap_cmd *issue_imap_cmd(struct imap_store *ctx,
|
||||
struct imap_cmd_cb *cb,
|
||||
const char *fmt, ...)
|
||||
|
@ -575,6 +579,7 @@ static struct imap_cmd *issue_imap_cmd(struct imap_store *ctx,
|
|||
return ret;
|
||||
}
|
||||
|
||||
__attribute__((format (printf, 3, 4)))
|
||||
static int imap_exec(struct imap_store *ctx, struct imap_cmd_cb *cb,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
|
@ -590,6 +595,7 @@ static int imap_exec(struct imap_store *ctx, struct imap_cmd_cb *cb,
|
|||
return get_cmd_result(ctx, cmdp);
|
||||
}
|
||||
|
||||
__attribute__((format (printf, 3, 4)))
|
||||
static int imap_exec_m(struct imap_store *ctx, struct imap_cmd_cb *cb,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
|
@ -880,7 +886,7 @@ static int get_cmd_result(struct imap_store *ctx, struct imap_cmd *tcmd)
|
|||
if (!strcmp("NO", arg)) {
|
||||
if (cmdp->cb.create && cmd && (cmdp->cb.trycreate || !memcmp(cmd, "[TRYCREATE]", 11))) { /* SELECT, APPEND or UID COPY */
|
||||
p = strchr(cmdp->cmd, '"');
|
||||
if (!issue_imap_cmd(ctx, NULL, "CREATE \"%.*s\"", strchr(p + 1, '"') - p + 1, p)) {
|
||||
if (!issue_imap_cmd(ctx, NULL, "CREATE \"%.*s\"", (int)(strchr(p + 1, '"') - p + 1), p)) {
|
||||
resp = RESP_BAD;
|
||||
goto normal;
|
||||
}
|
||||
|
|
|
@ -86,6 +86,7 @@ static void flush_output(struct merge_options *o)
|
|||
}
|
||||
}
|
||||
|
||||
__attribute__((format (printf, 3, 4)))
|
||||
static void output(struct merge_options *o, int v, const char *fmt, ...)
|
||||
{
|
||||
int len;
|
||||
|
@ -214,7 +215,8 @@ struct tree *write_tree_from_memory(struct merge_options *o)
|
|||
for (i = 0; i < active_nr; i++) {
|
||||
struct cache_entry *ce = active_cache[i];
|
||||
if (ce_stage(ce))
|
||||
output(o, 0, "%d %.*s", ce_stage(ce), ce_namelen(ce), ce->name);
|
||||
output(o, 0, "%d %.*s", ce_stage(ce),
|
||||
(int)ce_namelen(ce), ce->name);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
2
strbuf.h
2
strbuf.h
|
@ -117,7 +117,7 @@ struct strbuf_expand_dict_entry {
|
|||
};
|
||||
extern size_t strbuf_expand_dict_cb(struct strbuf *sb, const char *placeholder, void *context);
|
||||
|
||||
__attribute__((format(printf,2,3)))
|
||||
__attribute__((format (printf,2,3)))
|
||||
extern void strbuf_addf(struct strbuf *sb, const char *fmt, ...);
|
||||
|
||||
extern size_t strbuf_fread(struct strbuf *, size_t, FILE *);
|
||||
|
|
Загрузка…
Ссылка в новой задаче