summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 77097fa)
raw | patch | inline | side by side (parent: 77097fa)
author | Tarmigan Casebolt <tarmigan+git@gmail.com> | |
Sat, 14 Nov 2009 21:33:13 +0000 (13:33 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 16 Nov 2009 02:24:58 +0000 (18:24 -0800) |
We already have these checks in many printf-type functions that have
prototypes which are in header files. Add these same checks to some
more prototypes in header functions and to static functions in .c
files.
cc: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Tarmigan Casebolt <tarmigan+git@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
prototypes which are in header files. Add these same checks to some
more prototypes in header functions and to static functions in .c
files.
cc: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Tarmigan Casebolt <tarmigan+git@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-fsck.c | patch | blob | history | |
builtin-update-index.c | patch | blob | history | |
builtin-upload-archive.c | patch | blob | history | |
cache.h | patch | blob | history | |
color.h | patch | blob | history | |
daemon.c | patch | blob | history | |
fsck.h | patch | blob | history | |
imap-send.c | patch | blob | history | |
merge-recursive.c | patch | blob | history | |
strbuf.h | patch | blob | history |
diff --git a/builtin-fsck.c b/builtin-fsck.c
index 2d88e4570f8217beaf7f5400dc3c3a328222ebe8..0e5faae381ed94c26671fcae04ea96d3656d7627 100644 (file)
--- a/builtin-fsck.c
+++ b/builtin-fsck.c
fputs("\n", stderr);
}
+__attribute__((format (printf, 2, 3)))
static int objerror(struct object *obj, const char *err, ...)
{
va_list params;
return -1;
}
+__attribute__((format (printf, 3, 4)))
static int fsck_error_func(struct object *obj, int type, const char *err, ...)
{
va_list params;
diff --git a/builtin-update-index.c b/builtin-update-index.c
index 92beaaf4b3ca5520a9af27bde7f15dda46d80197..a6b7f2d6361fc1e8ea9713082affc72362f08d76 100644 (file)
--- a/builtin-update-index.c
+++ b/builtin-update-index.c
#define MARK_VALID 1
#define UNMARK_VALID 2
+__attribute__((format (printf, 1, 2)))
static void report(const char *fmt, ...)
{
va_list vp;
index c4cd1e1327f18ae27b74fac6dfd41938cd9dfe5d..b2d12592a3320fc1763dc1496a188e887ca8c7ce 100644 (file)
--- a/builtin-upload-archive.c
+++ b/builtin-upload-archive.c
return write_archive(sent_argc, sent_argv, prefix, 0);
}
+__attribute__((format (printf, 1, 2)))
static void error_clnt(const char *fmt, ...)
{
char buf[1024];
index 71a731dbc988a8a22d0a2e1f8f3a5223f4c5d67a..ff45269d295c61797d55ca27e44cd218980d6505 100644 (file)
--- a/cache.h
+++ b/cache.h
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 */
index 18abeb7c7dd47794d4f5fea4049b5719f03383fe..7d8da6fe2207ae4adb7ab888edd57ab571665458 100644 (file)
--- a/color.h
+++ b/color.h
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);
diff --git a/daemon.c b/daemon.c
index 1b5ada6648da66d14dec6c399898916920582852..641ebe16dd3ee07e3e2a4ed6d6b646764391333b 100644 (file)
--- a/daemon.c
+++ b/daemon.c
}
}
+__attribute__((format (printf, 1, 2)))
static void logerror(const char *err, ...)
{
va_list params;
va_end(params);
}
+__attribute__((format (printf, 1, 2)))
static void loginfo(const char *err, ...)
{
va_list params;
index 008456b675b6e5c8a5a07e0b8628a41e3acc733a..1e4f527318ea4b4d701a27e08d68f3551173f176 100644 (file)
--- a/fsck.h
+++ b/fsck.h
/* 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
diff --git a/imap-send.c b/imap-send.c
index f805c6ed813bbc6130bcd2d9f89bdb44ad9625e1..57a3c65dda00ac5b04386978988b668be0815543 100644 (file)
--- a/imap-send.c
+++ b/imap-send.c
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)
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, ...)
return ret;
}
+__attribute__((format (printf, 3, 4)))
static int imap_exec(struct imap_store *ctx, struct imap_cmd_cb *cb,
const char *fmt, ...)
{
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, ...)
{
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;
}
diff --git a/merge-recursive.c b/merge-recursive.c
index f55b7ebe11bbd54f00a84dd1eb9d34f60d74a1c3..baabe2c35647d65716d1b82473846e80cc02957b 100644 (file)
--- a/merge-recursive.c
+++ b/merge-recursive.c
}
}
+__attribute__((format (printf, 3, 4)))
static void output(struct merge_options *o, int v, const char *fmt, ...)
{
int len;
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;
}
diff --git a/strbuf.h b/strbuf.h
index d05e056dd3916b64865ac9a0337ecbf31625f436..fa07ecf094bd3ef8997958fde29199f8fb6421b9 100644 (file)
--- a/strbuf.h
+++ b/strbuf.h
};
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 *);