mirror of
https://github.com/sbrow/thor.git
synced 2026-08-26 11:23:32 -04:00
perf: Fixed leaks.
This commit is contained in:
@@ -365,7 +365,6 @@ test_gutter_pipes_align_with_source_pipe :: proc(t: ^testing.T) {
|
||||
// For width=1: source line is "N | ...", so "|" at col 2.
|
||||
// Empty gutter is " |" (width+1 spaces + "|"), so "|" at col 2.
|
||||
lines := strings.split(out, "\n", context.temp_allocator)
|
||||
defer delete(lines)
|
||||
pipe_col := -1
|
||||
for line in lines {
|
||||
idx := strings.index(line, "|")
|
||||
@@ -387,7 +386,6 @@ test_arrow_points_at_pipe :: proc(t: ^testing.T) {
|
||||
// For width=1: arrow line is " --> ..." so ">" at col 3.
|
||||
// Pipe lines are " |" so "|" at col 2.
|
||||
lines := strings.split(out, "\n", context.temp_allocator)
|
||||
defer delete(lines)
|
||||
|
||||
pipe_col := -1
|
||||
for line in lines {
|
||||
|
||||
@@ -846,7 +846,6 @@ warn_missing_partial :: proc(
|
||||
) {
|
||||
hint := ""
|
||||
available := collect_partial_names(partials)
|
||||
defer delete(available)
|
||||
suggestion := suggest_correction(available, name)
|
||||
if suggestion != "" {
|
||||
hint = fmt.tprintf("did you mean '%s'?", suggestion)
|
||||
@@ -872,7 +871,6 @@ warn_unmatched_block_overrides :: proc(
|
||||
return
|
||||
}
|
||||
available := collect_block_names(parent)
|
||||
defer delete(available)
|
||||
parent_path := parent.path
|
||||
if parent_path == "" {
|
||||
parent_path = "<input>"
|
||||
|
||||
@@ -6,7 +6,7 @@ import "core:strings"
|
||||
// collect_struct_keys enumerates the visible field names of a struct value,
|
||||
// including fields promoted via `using`-embedded structs.
|
||||
collect_struct_keys :: proc(val: any, allocator := context.temp_allocator) -> []string {
|
||||
out: [dynamic]string
|
||||
out := make([dynamic]string, 0, 0, allocator)
|
||||
collect_struct_keys_into(val, &out, allocator)
|
||||
return out[:]
|
||||
}
|
||||
@@ -111,7 +111,7 @@ validate_key_path :: proc(
|
||||
}
|
||||
|
||||
if !found {
|
||||
keys: [dynamic]string
|
||||
keys := make([dynamic]string, 0, 4, allocator)
|
||||
for i := len(ctx) - 1; i >= 0; i -= 1 {
|
||||
collect_struct_keys_into(ctx[i], &keys, allocator)
|
||||
}
|
||||
@@ -178,7 +178,7 @@ collect_partial_names :: proc(
|
||||
partials: map[string]Template,
|
||||
allocator := context.temp_allocator,
|
||||
) -> []string {
|
||||
out: [dynamic]string
|
||||
out := make([dynamic]string, 0, 0, allocator)
|
||||
for name in partials {
|
||||
append(&out, name)
|
||||
}
|
||||
@@ -191,7 +191,7 @@ collect_block_names :: proc(
|
||||
tmpl: Template,
|
||||
allocator := context.temp_allocator,
|
||||
) -> []string {
|
||||
out: [dynamic]string
|
||||
out := make([dynamic]string, 0, 0, allocator)
|
||||
seen := make(map[string]bool, allocator)
|
||||
defer delete(seen)
|
||||
for &node in tmpl.nodes {
|
||||
|
||||
@@ -139,6 +139,7 @@ test_validate_map_path_silent :: proc(t: ^testing.T) {
|
||||
data := Params_Data {
|
||||
params = {"social" = "x"},
|
||||
}
|
||||
defer delete(data.params)
|
||||
ctx := make([dynamic]any, 0, 1, context.temp_allocator)
|
||||
append(&ctx, data)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user