Thread (1 message) 1 message, 1 author, 2021-11-19

Re: [PATCH 4/6] alloc.[ch]: remove alloc_report() function

From: Junio C Hamano <hidden>
Date: 2021-11-19 19:42:09

Ævar Arnfjörð Bjarmason  [off-list ref] writes:
The alloc_report() function has been orphaned since its introduction
in 855419f764a (Add specialized object allocator, 2006-06-19), it
appears to have been used for demonstration purposes in that commit
message.
Stopping a program in debugger, and calling these functions that
have otherwise no callers, is a fairly handy way to debug.
It is likely that we used it while developing the allocator.

If we truly want to get rid of it, we'd want to lose the "count"
member from the alloc_state structure, which is otherwise unused, I
would think.

Even though I do not think 5/6 and 6/6 in this series are good idea,
I am on the fence on this one, slightly leaning to "lose it" but not
that strongly.
quoted hunk
Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 alloc.c | 19 -------------------
 alloc.h |  1 -
 2 files changed, 20 deletions(-)
diff --git a/alloc.c b/alloc.c
index 957a0af3626..bf7982712f1 100644
--- a/alloc.c
+++ b/alloc.c
@@ -122,22 +122,3 @@ void *alloc_commit_node(struct repository *r)
 	init_commit_node(c);
 	return c;
 }
-
-static void report(const char *name, unsigned int count, size_t size)
-{
-	fprintf(stderr, "%10s: %8u (%"PRIuMAX" kB)\n",
-			name, count, (uintmax_t) size);
-}
-
-#define REPORT(name, type)	\
-    report(#name, r->parsed_objects->name##_state->count, \
-		  r->parsed_objects->name##_state->count * sizeof(type) >> 10)
-
-void alloc_report(struct repository *r)
-{
-	REPORT(blob, struct blob);
-	REPORT(tree, struct tree);
-	REPORT(commit, struct commit);
-	REPORT(tag, struct tag);
-	REPORT(object, union any_object);
-}
diff --git a/alloc.h b/alloc.h
index 371d388b552..3f4a0ad310a 100644
--- a/alloc.h
+++ b/alloc.h
@@ -13,7 +13,6 @@ void init_commit_node(struct commit *c);
 void *alloc_commit_node(struct repository *r);
 void *alloc_tag_node(struct repository *r);
 void *alloc_object_node(struct repository *r);
-void alloc_report(struct repository *r);
 
 struct alloc_state *allocate_alloc_state(void);
 void clear_alloc_state(struct alloc_state *s);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help