alloc.[ch]: remove alloc_report() function
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>
Ævar Arnfjörð Bjarmason committed
Mar 31, 2022 at 03:45 UTC
0b75e5bf22d6c2ad0589990613478277a7a48c6f
2 files changed
-22
alloc.c
-21
@@ -27,7 +27,6 @@ union any_object {
27
};
28
29
struct alloc_state {
30
- int count; /* total number of nodes allocated */
30
int nr; /* number of nodes left in current allocation */
31
void *p; /* first free node in current allocation */
32
@@ -63,7 +62,6 @@ static inline void *alloc_node(struct alloc_state *s, size_t node_size)
62
s->slabs[s->slab_nr++] = s->p;
63
}
64
s->nr--;
66
- s->count++;
65
ret = s->p;
66
s->p = (char *)s->p + node_size;
67
memset(ret, 0, node_size);
@@ -122,22 +120,3 @@ void *alloc_commit_node(struct repository *r)
120
init_commit_node(c);
121
return c;
122
}
125
-
126
-static void report(const char *name, unsigned int count, size_t size)
127
-{
128
- fprintf(stderr, "%10s: %8u (%"PRIuMAX" kB)\n",
129
- name, count, (uintmax_t) size);
130
-}
131
-
132
-#define REPORT(name, type) \
133
- report(#name, r->parsed_objects->name##_state->count, \
134
- r->parsed_objects->name##_state->count * sizeof(type) >> 10)
135
-
136
-void alloc_report(struct repository *r)
137
-{
138
- REPORT(blob, struct blob);
139
- REPORT(tree, struct tree);
140
- REPORT(commit, struct commit);
141
- REPORT(tag, struct tag);
142
- REPORT(object, union any_object);
143
-}
alloc.h
-1
@@ -13,7 +13,6 @@ void init_commit_node(struct commit *c);
13
void *alloc_commit_node(struct repository *r);
14
void *alloc_tag_node(struct repository *r);
15
void *alloc_object_node(struct repository *r);
16
-void alloc_report(struct repository *r);
16
17
struct alloc_state *allocate_alloc_state(void);
18
void clear_alloc_state(struct alloc_state *s);