summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bc6b4f5)
raw | patch | inline | side by side (parent: bc6b4f5)
author | Jason Riedy <ejr@EECS.Berkeley.EDU> | |
Tue, 20 Feb 2007 00:27:09 +0000 (16:27 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Tue, 20 Feb 2007 02:20:49 +0000 (18:20 -0800) |
Define UM_FMT and UM10_FMT and use in place of %ju and %10ju,
respectively. Both format as unsigned long long, so this
assumes the compiler supports long long.
Signed-off-by: Jason Riedy <jason@acm.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
respectively. Both format as unsigned long long, so this
assumes the compiler supports long long.
Signed-off-by: Jason Riedy <jason@acm.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
fast-import.c | patch | blob | history |
diff --git a/fast-import.c b/fast-import.c
index fd3b11757498d504b3954f70c602603d65277440..8720090a3e54f09d31ef447cc143c39f75c5c365 100644 (file)
--- a/fast-import.c
+++ b/fast-import.c
#define PACK_ID_BITS 16
#define MAX_PACK_ID ((1<<PACK_ID_BITS)-1)
+#if !defined(NO_C99_FORMAT)
+#define UM_FMT "%ju"
+#define UM10_FMT "%10ju"
+#else
+/* Assumes unsigned long long exists. */
+#define UM_FMT "%llu"
+#define UM10_FMT "%10llu"
+#endif
+
struct object_entry
{
struct object_entry *next;
oe = s->data.marked[idnum];
}
if (!oe)
- die("mark :%ju not declared", orig_idnum);
+ die("mark :" UM_FMT " not declared", orig_idnum);
return oe;
}
} else {
for (k = 0; k < 1024; k++) {
if (m->data.marked[k])
- fprintf(f, ":%ju %s\n", base + k,
+ fprintf(f, ":" UM_FMT " %s\n", base + k,
sha1_to_hex(m->data.marked[k]->sha1));
}
}
unsigned long size;
char *buf;
if (oe->type != OBJ_COMMIT)
- die("Mark :%ju not a commit", idnum);
+ die("Mark :" UM_FMT " not a commit", idnum);
hashcpy(b->sha1, oe->sha1);
buf = gfi_unpack_entry(oe, &size);
if (!buf || size < 46)
uintmax_t idnum = strtoumax(from + 1, NULL, 10);
struct object_entry *oe = find_mark(idnum);
if (oe->type != OBJ_COMMIT)
- die("Mark :%ju not a commit", idnum);
+ die("Mark :" UM_FMT " not a commit", idnum);
hashcpy(n->sha1, oe->sha1);
} else if (get_sha1(from, n->sha1))
die("Invalid ref name or SHA1 expression: %s", from);
from_mark = strtoumax(from + 1, NULL, 10);
oe = find_mark(from_mark);
if (oe->type != OBJ_COMMIT)
- die("Mark :%ju not a commit", from_mark);
+ die("Mark :" UM_FMT " not a commit", from_mark);
hashcpy(sha1, oe->sha1);
} else if (!get_sha1(from, sha1)) {
unsigned long size;
fprintf(stderr, "%s statistics:\n", argv[0]);
fprintf(stderr, "---------------------------------------------------------------------\n");
- fprintf(stderr, "Alloc'd objects: %10ju\n", alloc_count);
- fprintf(stderr, "Total objects: %10ju (%10ju duplicates )\n", total_count, duplicate_count);
- fprintf(stderr, " blobs : %10ju (%10ju duplicates %10ju deltas)\n", object_count_by_type[OBJ_BLOB], duplicate_count_by_type[OBJ_BLOB], delta_count_by_type[OBJ_BLOB]);
- fprintf(stderr, " trees : %10ju (%10ju duplicates %10ju deltas)\n", object_count_by_type[OBJ_TREE], duplicate_count_by_type[OBJ_TREE], delta_count_by_type[OBJ_TREE]);
- fprintf(stderr, " commits: %10ju (%10ju duplicates %10ju deltas)\n", object_count_by_type[OBJ_COMMIT], duplicate_count_by_type[OBJ_COMMIT], delta_count_by_type[OBJ_COMMIT]);
- fprintf(stderr, " tags : %10ju (%10ju duplicates %10ju deltas)\n", object_count_by_type[OBJ_TAG], duplicate_count_by_type[OBJ_TAG], delta_count_by_type[OBJ_TAG]);
+ fprintf(stderr, "Alloc'd objects: " UM10_FMT "\n", alloc_count);
+ fprintf(stderr, "Total objects: " UM10_FMT " (" UM10_FMT " duplicates )\n", total_count, duplicate_count);
+ fprintf(stderr, " blobs : " UM10_FMT " (" UM10_FMT " duplicates " UM10_FMT " deltas)\n", object_count_by_type[OBJ_BLOB], duplicate_count_by_type[OBJ_BLOB], delta_count_by_type[OBJ_BLOB]);
+ fprintf(stderr, " trees : " UM10_FMT " (" UM10_FMT " duplicates " UM10_FMT " deltas)\n", object_count_by_type[OBJ_TREE], duplicate_count_by_type[OBJ_TREE], delta_count_by_type[OBJ_TREE]);
+ fprintf(stderr, " commits: " UM10_FMT " (" UM10_FMT " duplicates " UM10_FMT " deltas)\n", object_count_by_type[OBJ_COMMIT], duplicate_count_by_type[OBJ_COMMIT], delta_count_by_type[OBJ_COMMIT]);
+ fprintf(stderr, " tags : " UM10_FMT " (" UM10_FMT " duplicates " UM10_FMT " deltas)\n", object_count_by_type[OBJ_TAG], duplicate_count_by_type[OBJ_TAG], delta_count_by_type[OBJ_TAG]);
fprintf(stderr, "Total branches: %10lu (%10lu loads )\n", branch_count, branch_load_count);
- fprintf(stderr, " marks: %10ju (%10ju unique )\n", (((uintmax_t)1) << marks->shift) * 1024, marks_set_count);
+ fprintf(stderr, " marks: " UM10_FMT " (" UM10_FMT " unique )\n", (((uintmax_t)1) << marks->shift) * 1024, marks_set_count);
fprintf(stderr, " atoms: %10u\n", atom_cnt);
- fprintf(stderr, "Memory total: %10ju KiB\n", (total_allocd + alloc_count*sizeof(struct object_entry))/1024);
+ fprintf(stderr, "Memory total: " UM10_FMT " KiB\n", (total_allocd + alloc_count*sizeof(struct object_entry))/1024);
fprintf(stderr, " pools: %10lu KiB\n", (unsigned long)(total_allocd/1024));
- fprintf(stderr, " objects: %10ju KiB\n", (alloc_count*sizeof(struct object_entry))/1024);
+ fprintf(stderr, " objects: " UM10_FMT " KiB\n", (alloc_count*sizeof(struct object_entry))/1024);
fprintf(stderr, "---------------------------------------------------------------------\n");
pack_report();
fprintf(stderr, "---------------------------------------------------------------------\n");