summaryrefslogtreecommitdiff
path: root/alloc.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-08-07 17:02:07 -0700
committerJunio C Hamano <junkio@cox.net>2006-08-07 17:02:07 -0700
commit9673198ee867cea4ed70d2cf54c1a2eb8f27bb46 (patch)
treef06a5be02102b0a78f56e18beffa8fa5c3e70b6e /alloc.c
parent96bc4de85cf810db5c7cd94bf0688a98a64a0bc7 (diff)
parent7c49cb288173ab5264b3b9e4257aeeb13388334c (diff)
downloadgit-9673198ee867cea4ed70d2cf54c1a2eb8f27bb46.tar.gz
Merge branch 'master' into pb/gitpm
This is to resolve the conflicts with Ryan's annotate updates early.
Diffstat (limited to 'alloc.c')
-rw-r--r--alloc.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/alloc.c b/alloc.c
index e3b22f4322..460db192d5 100644
--- a/alloc.c
+++ b/alloc.c
@@ -39,8 +39,21 @@ DEFINE_ALLOCATOR(tree)
DEFINE_ALLOCATOR(commit)
DEFINE_ALLOCATOR(tag)
+#ifdef NO_C99_FORMAT
+#define SZ_FMT "%u"
+#else
+#define SZ_FMT "%zu"
+#endif
+
+static void report(const char* name, unsigned int count, size_t size)
+{
+ fprintf(stderr, "%10s: %8u (" SZ_FMT " kB)\n", name, count, size);
+}
+
+#undef SZ_FMT
+
#define REPORT(name) \
- fprintf(stderr, "%10s: %8u (%zu kB)\n", #name, name##_allocs, name##_allocs*sizeof(struct name) >> 10)
+ report(#name, name##_allocs, name##_allocs*sizeof(struct name) >> 10)
void alloc_report(void)
{