]> git.ipfire.org Git - thirdparty/git.git/commitdiff
alloc.[ch]: remove alloc_report() function
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Thu, 31 Mar 2022 01:45:55 +0000 (03:45 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 1 Apr 2022 17:16:11 +0000 (10:16 -0700)
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.

These might be handy to manually use in a debugger, but keeping them
and the "count" member of "alloc_state" just for that doesn't seem
worth it.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
alloc.c
alloc.h

diff --git a/alloc.c b/alloc.c
index 957a0af3626432b0c9c2dd1301f20c4ff339a0a4..27f697e4c87a05ef7cc847a17e83e14e9cfd2a4d 100644 (file)
--- a/alloc.c
+++ b/alloc.c
@@ -27,7 +27,6 @@ union any_object {
 };
 
 struct alloc_state {
-       int count; /* total number of nodes allocated */
        int nr;    /* number of nodes left in current allocation */
        void *p;   /* first free node in current allocation */
 
@@ -63,7 +62,6 @@ static inline void *alloc_node(struct alloc_state *s, size_t node_size)
                s->slabs[s->slab_nr++] = s->p;
        }
        s->nr--;
-       s->count++;
        ret = s->p;
        s->p = (char *)s->p + node_size;
        memset(ret, 0, node_size);
@@ -122,22 +120,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 371d388b552fb01824b4ec208abe7fdf11d95eec..3f4a0ad310a94bd026f48f48491985e3e2053ee2 100644 (file)
--- 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);