diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2022-03-30 18:23:59 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2022-09-19 15:09:51 -0400 |
commit | 6e9b1b344b7f7b04a2ae4ace0a1d191f63d03396 (patch) | |
tree | 5ac3a016544e13a6b1cf54aa4762f53a0ebaeb5e /firmware | |
parent | 3090cf0da4edde67234faaeda18de91fa91aa5ef (diff) | |
download | rockbox-6e9b1b344b7f7b04a2ae4ace0a1d191f63d03396.tar.gz rockbox-6e9b1b344b7f7b04a2ae4ace0a1d191f63d03396.zip |
buflib: remove buflib_print_allocs / buflib_print_blocks
These don't have any users and there is already another way to
print blocks (which is actually used by the debug menu).
Change-Id: Ic6a4f874c6499c42bc046e8af3e4aaddc9e68276
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/buflib.c | 46 | ||||
-rw-r--r-- | firmware/include/buflib.h | 21 | ||||
-rw-r--r-- | firmware/include/core_alloc.h | 4 |
3 files changed, 0 insertions, 71 deletions
diff --git a/firmware/buflib.c b/firmware/buflib.c index 2ed13b49b1..6bfc499235 100644 --- a/firmware/buflib.c +++ b/firmware/buflib.c | |||
@@ -1068,52 +1068,6 @@ void buflib_check_valid(struct buflib_context *ctx) | |||
1068 | } | 1068 | } |
1069 | #endif | 1069 | #endif |
1070 | 1070 | ||
1071 | #ifdef BUFLIB_DEBUG_BLOCKS | ||
1072 | void buflib_print_allocs(struct buflib_context *ctx, | ||
1073 | void (*print)(int, const char*)) | ||
1074 | { | ||
1075 | union buflib_data *this, *end = ctx->handle_table; | ||
1076 | char buf[128]; | ||
1077 | for(this = end - 1; this >= ctx->last_handle; this--) | ||
1078 | { | ||
1079 | if (!this->alloc) continue; | ||
1080 | |||
1081 | int handle_num = end - this; | ||
1082 | void* alloc_start = this->alloc; | ||
1083 | union buflib_data *block_start = handle_to_block(ctx, handle_num); | ||
1084 | const char* name = buflib_get_name(ctx, handle_num); | ||
1085 | intptr_t alloc_len = block_start[fidx_LEN]; | ||
1086 | |||
1087 | snprintf(buf, sizeof(buf), | ||
1088 | "%s(%d):\t%p\n" | ||
1089 | " \t%p\n" | ||
1090 | " \t%ld\n", | ||
1091 | name?:"(null)", handle_num, block_start, alloc_start, alloc_len); | ||
1092 | /* handle_num is 1-based */ | ||
1093 | print(handle_num - 1, buf); | ||
1094 | } | ||
1095 | } | ||
1096 | |||
1097 | void buflib_print_blocks(struct buflib_context *ctx, | ||
1098 | void (*print)(int, const char*)) | ||
1099 | { | ||
1100 | char buf[128]; | ||
1101 | int i = 0; | ||
1102 | |||
1103 | for(union buflib_data *block = ctx->buf_start; | ||
1104 | block != ctx->alloc_end; | ||
1105 | block += abs(block->val)) | ||
1106 | { | ||
1107 | check_block_length(ctx, block); | ||
1108 | |||
1109 | snprintf(buf, sizeof(buf), "%8p: val: %4ld (%s)", | ||
1110 | block, (long)block->val, | ||
1111 | block->val > 0 ? block[fidx_NAME].name : "<unallocated>"); | ||
1112 | print(i++, buf); | ||
1113 | } | ||
1114 | } | ||
1115 | #endif | ||
1116 | |||
1117 | #ifdef BUFLIB_DEBUG_BLOCK_SINGLE | 1071 | #ifdef BUFLIB_DEBUG_BLOCK_SINGLE |
1118 | int buflib_get_num_blocks(struct buflib_context *ctx) | 1072 | int buflib_get_num_blocks(struct buflib_context *ctx) |
1119 | { | 1073 | { |
diff --git a/firmware/include/buflib.h b/firmware/include/buflib.h index 5bd8d73ada..a4796fbf33 100644 --- a/firmware/include/buflib.h +++ b/firmware/include/buflib.h | |||
@@ -342,27 +342,6 @@ void buflib_buffer_in(struct buflib_context *ctx, int size); | |||
342 | const char* buflib_get_name(struct buflib_context *ctx, int handle); | 342 | const char* buflib_get_name(struct buflib_context *ctx, int handle); |
343 | 343 | ||
344 | /** | 344 | /** |
345 | * Prints an overview of all current allocations with the help | ||
346 | * of the passed printer helper | ||
347 | * | ||
348 | * This walks only the handle table and prints only valid allocations | ||
349 | * | ||
350 | * Only available if BUFLIB_DEBUG_BLOCKS is defined | ||
351 | */ | ||
352 | void buflib_print_allocs(struct buflib_context *ctx, void (*print)(int, const char*)); | ||
353 | |||
354 | /** | ||
355 | * Prints an overview of all blocks in the buflib buffer, allocated | ||
356 | * or unallocated, with the help of the passed printer helper | ||
357 | * | ||
358 | * This walks the entire buffer and prints unallocated space also. | ||
359 | * The output is also different from buflib_print_allocs(). | ||
360 | * | ||
361 | * Only available if BUFLIB_DEBUG_BLOCKS is defined | ||
362 | */ | ||
363 | void buflib_print_blocks(struct buflib_context *ctx, void (*print)(int, const char*)); | ||
364 | |||
365 | /** | ||
366 | * Gets the number of blocks in the entire buffer, allocated or unallocated | 345 | * Gets the number of blocks in the entire buffer, allocated or unallocated |
367 | * | 346 | * |
368 | * Only available if BUFLIB_DEBUG_BLOCK_SIGNLE is defined | 347 | * Only available if BUFLIB_DEBUG_BLOCK_SIGNLE is defined |
diff --git a/firmware/include/core_alloc.h b/firmware/include/core_alloc.h index 67fe99dfdc..f535fc1f6e 100644 --- a/firmware/include/core_alloc.h +++ b/firmware/include/core_alloc.h | |||
@@ -25,10 +25,6 @@ void core_check_valid(void); | |||
25 | /* DO NOT ADD wrappers for buflib_buffer_out/in. They do not call | 25 | /* DO NOT ADD wrappers for buflib_buffer_out/in. They do not call |
26 | * the move callbacks and are therefore unsafe in the core */ | 26 | * the move callbacks and are therefore unsafe in the core */ |
27 | 27 | ||
28 | #ifdef BUFLIB_DEBUG_BLOCKS | ||
29 | void core_print_allocs(void (*print)(const char*)); | ||
30 | void core_print_blocks(void (*print)(const char*)); | ||
31 | #endif | ||
32 | #ifdef BUFLIB_DEBUG_BLOCK_SINGLE | 28 | #ifdef BUFLIB_DEBUG_BLOCK_SINGLE |
33 | int core_get_num_blocks(void); | 29 | int core_get_num_blocks(void); |
34 | void core_print_block_at(int block_num, char* buf, size_t bufsize); | 30 | void core_print_block_at(int block_num, char* buf, size_t bufsize); |