don't pass scratch_arena to render_range_bytes_to_string

This commit is contained in:
silverweed 2024-08-21 13:31:32 +02:00
parent 34078f92ba
commit df2c4c2a89

View file

@ -95,8 +95,11 @@ String8_Node *render_info_to_string(Arena *arena, Byte_Range range, const App_St
}
internal
String8 render_range_bytes_to_string(Arena *arena, Arena *scratch_arena, App_State &app, Term_Viewer &viewer, Byte_Range range, u64 n_cols)
String8 render_range_bytes_to_string(Arena *arena, App_State &app, Term_Viewer &viewer, Byte_Range range, u64 n_cols)
{
Temp scratch = scratch_begin(&arena, 1);
defer { scratch_end(scratch); };
if (n_cols == 0)
n_cols = 32;
@ -112,7 +115,7 @@ String8 render_range_bytes_to_string(Arena *arena, Arena *scratch_arena, App_Sta
u64 max_addr_len = 1 + ceilf(logf(max_addr + 1) * RECP_LOG_16);
const u64 n_spaces_after_line_addr = 3;
u64 line_addr_size = (max_addr_len + n_spaces_after_line_addr) * n_lines;
String8 line_addr_fmt = push_str8f(scratch_arena, "%%0%dlX:", max_addr_len - 1);
String8 line_addr_fmt = push_str8f(scratch.arena, "%%0%dlX:", max_addr_len - 1);
// NOTE: +3 because we need 2 chars for each byte + 1 whitespace.
u64 buf_size = (ACOL_MAX_LEN + 3) * len; // at most one color per byte
@ -192,7 +195,7 @@ String8_Node *render_range_to_string(Arena *arena, App_State &app, u64 len, u64
// Bytes view
String8_Node *bytes_view = arena_push<String8_Node>(arena);
Byte_Range range = { app.base_display_addr, min(app.inspected_file.size - app.base_display_addr, len) };
bytes_view->str = render_range_bytes_to_string(arena, scratch.arena, app, viewer, range, n_cols);
bytes_view->str = render_range_bytes_to_string(arena, app, viewer, range, n_cols);
result_tail->next = bytes_view;
result_tail = bytes_view;