mirror of
https://github.com/sbrow/envr.git
synced 2026-08-26 09:53:32 -04:00
refactor(findr): Now accepts an allocator parameter.
This commit is contained in:
+9
-1
@@ -16,7 +16,14 @@ RepoPool :: struct {
|
||||
threads: []^thread.Thread,
|
||||
}
|
||||
|
||||
find_repos :: proc(roots: []string, results: ^[dynamic]string, thread_count: int) {
|
||||
find_repos :: proc(
|
||||
roots: []string,
|
||||
results: ^[dynamic]string,
|
||||
thread_count: int,
|
||||
allocator := context.allocator,
|
||||
) {
|
||||
// TODO: This may be a code smell
|
||||
context.allocator = allocator
|
||||
if len(roots) == 0 do return
|
||||
|
||||
pool := new(RepoPool)
|
||||
@@ -126,3 +133,4 @@ process_repo_dir :: proc(pool: ^RepoPool, dir_path: string) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-1
@@ -78,7 +78,15 @@ collect_worker :: proc(t: ^thread.Thread) {
|
||||
}
|
||||
}
|
||||
|
||||
walk :: proc(roots: []string, results: ^[dynamic]string, opts: WalkOptions, thread_count: int) {
|
||||
walk :: proc(
|
||||
roots: []string,
|
||||
results: ^[dynamic]string,
|
||||
opts: WalkOptions,
|
||||
thread_count: int,
|
||||
allocator := context.allocator,
|
||||
) {
|
||||
// TODO: This may be a code smell
|
||||
context.allocator = allocator
|
||||
if len(roots) == 0 do return
|
||||
|
||||
ch, _ := chan.create(chan.Chan([]u8), max(2 * thread_count, 2), context.allocator)
|
||||
|
||||
Reference in New Issue
Block a user