mirror of
https://github.com/sbrow/envr.git
synced 2026-06-27 10:38:33 -04:00
style: Ignored allocation errors where possible.
This commit is contained in:
24
TODOS.md
24
TODOS.md
@@ -1,6 +1,6 @@
|
||||
# TODOs
|
||||
|
||||
1. Commands are still leaking. (Do 13. first)
|
||||
1. Commands are still leaking. (Write tests for everything first)
|
||||
|
||||
2. Add color flag and support non colored output.
|
||||
|
||||
@@ -8,27 +8,25 @@
|
||||
|
||||
4. Generate md and man pages again.
|
||||
|
||||
5. Consistently ignore allocator errors
|
||||
5. Check for prealloc opportunities. i.e. `make([dynamic]string)` -> `make([dynamic]string, 5)`.
|
||||
|
||||
6. Check for prealloc opportunities. i.e. `make([dynamic]string)` -> `make([dynamic]string, 5)`.
|
||||
6. Add a text filter to the multi_select.
|
||||
|
||||
7. Add a text filter to the multi_select.
|
||||
7. Add tests for untested commands.
|
||||
|
||||
8. Add tests for untested commands.
|
||||
8. add --format -f flag to commands that draw tables.
|
||||
|
||||
9. add --format -f flag to commands that draw tables.
|
||||
9. procedures should be ordered by use, main at the top, then in the order they are called from main.
|
||||
|
||||
10. procedures should be ordered by use, main at the top, then in the order they are called from main.
|
||||
10. Shell completion
|
||||
|
||||
11. Shell completion
|
||||
11. Bring back windows support / cross-compilation.
|
||||
|
||||
12. Bring back windows support / cross-compilation.
|
||||
12. Test all cmds / terminal branches.
|
||||
|
||||
13. Test all cmds / terminal branches.
|
||||
13. Pass allocator to findr?
|
||||
|
||||
14. Pass allocator to findr?
|
||||
|
||||
15. Update `read_wire_string` to use a slice.
|
||||
14. Update `read_wire_string` to use a slice.
|
||||
|
||||
## Double-check AI output
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ new_config :: proc(
|
||||
for priv in private_key_paths {
|
||||
// TODO: Is this bad?
|
||||
priv_key := strings.clone(priv)
|
||||
pub, _ := strings.concatenate([]string{priv_key, ".pub"})
|
||||
pub := strings.concatenate([]string{priv_key, ".pub"})
|
||||
append(&keys, SshKeyPair{private = priv_key, public = pub})
|
||||
}
|
||||
|
||||
|
||||
4
db.odin
4
db.odin
@@ -572,7 +572,7 @@ try_move_dir :: proc(db: ^Db, f: ^EnvFile, allocator: mem.Allocator) -> (bool, S
|
||||
case 0:
|
||||
return false, .DirMissing
|
||||
case 1:
|
||||
f.dir, _ = strings.clone(matched_dir, allocator)
|
||||
f.dir = strings.clone(matched_dir, allocator)
|
||||
base := filepath.base(f.path)
|
||||
new_path, _ := filepath.join({f.dir, base}, allocator)
|
||||
f.path = new_path
|
||||
@@ -613,7 +613,7 @@ get_git_remotes :: proc(dir: string, allocator: mem.Allocator) -> [dynamic]strin
|
||||
}
|
||||
if !found {
|
||||
// FIXME: Currently leaks when adding a file with envr scan
|
||||
cloned, _ := strings.clone(url, allocator)
|
||||
cloned := strings.clone(url, allocator)
|
||||
append(&remotes, cloned)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ find_repos :: proc(roots: []string, results: ^[dynamic]string, thread_count: int
|
||||
pool.threads = make([]^thread.Thread, thread_count)
|
||||
|
||||
for root in roots {
|
||||
root_clone, _ := strings.clone(root)
|
||||
root_clone := strings.clone(root)
|
||||
append(&pool.queue, root_clone)
|
||||
sync.atomic_sema_post(&pool.queue_sema)
|
||||
}
|
||||
@@ -97,7 +97,7 @@ process_repo_dir :: proc(pool: ^RepoPool, dir_path: string) {
|
||||
defer linux.close(fd)
|
||||
|
||||
if has_git_dir(fd) {
|
||||
cloned, _ := strings.clone(dir_path)
|
||||
cloned := strings.clone(dir_path)
|
||||
sync.mutex_lock(&pool.results_lock)
|
||||
append(pool.results, cloned)
|
||||
sync.mutex_unlock(&pool.results_lock)
|
||||
|
||||
@@ -137,7 +137,7 @@ collect_results :: proc(env: TestEnv, args: []string, opts: WalkOptions) -> [dyn
|
||||
if len(stripped) > 0 && stripped[0] == os.Path_Separator {
|
||||
stripped = stripped[1:]
|
||||
}
|
||||
new_r, _ := strings.clone(stripped)
|
||||
new_r := strings.clone(stripped)
|
||||
delete(r)
|
||||
results[i] = new_r
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user