[PATCH 1/4] Prefer %d over %i in printf format strings.
From: Shawn O. Pearce <hidden>
Date: 2016-06-15 22:42:51
Subsystem:
the rest · Maintainer:
Linus Torvalds
The git project seems to prefer using %d when formatting signed integer values. These handful of locations were noticed by Junio as not conforming. At least one of them was my fault, perhaps the others were too. :-) Signed-off-by: Shawn O. Pearce <redacted> --- builtin-describe.c | 2 +- receive-pack.c | 2 +- sha1_file.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/builtin-describe.c b/builtin-describe.c
index 4921eee..f8afb9c 100644
--- a/builtin-describe.c
+++ b/builtin-describe.c@@ -182,7 +182,7 @@ static void describe(const char *arg, int last_one) fprintf(stderr, "traversed %lu commits\n", seen_commits); if (gave_up_on) { fprintf(stderr, - "more than %i tags found; listed %i most recent\n" + "more than %d tags found; listed %d most recent\n" "gave up search at %s\n", max_candidates, max_candidates, sha1_to_hex(gave_up_on->object.sha1));
diff --git a/receive-pack.c b/receive-pack.c
index 7d26326..19bc685 100644
--- a/receive-pack.c
+++ b/receive-pack.c@@ -317,7 +317,7 @@ static const char *unpack(void) char keep_arg[256]; char packname[46]; - s = sprintf(keep_arg, "--keep=receive-pack %i on ", getpid()); + s = sprintf(keep_arg, "--keep=receive-pack %d on ", getpid()); if (gethostname(keep_arg + s, sizeof(keep_arg) - s)) strcpy(keep_arg + s, "localhost");
diff --git a/sha1_file.c b/sha1_file.c
index 498665e..335b4b4 100644
--- a/sha1_file.c
+++ b/sha1_file.c@@ -1326,7 +1326,7 @@ void *unpack_entry(struct packed_git *p, unsigned long offset, retval = unpack_compressed_entry(p, &w_curs, offset, size); break; default: - die("unknown object type %i in %s", kind, p->pack_name); + die("unknown object type %d in %s", kind, p->pack_name); } unuse_pack(&w_curs); return retval;
--
1.5.0.rc2.g8a816