summaryrefslogtreecommitdiff
path: root/firmware/buflib.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/buflib.c')
-rw-r--r--firmware/buflib.c46
1 files changed, 0 insertions, 46 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
1072void 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
1097void 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
1118int buflib_get_num_blocks(struct buflib_context *ctx) 1072int buflib_get_num_blocks(struct buflib_context *ctx)
1119{ 1073{