Correct context.allocator usage

This commit is contained in:
gingerBill
2021-09-19 11:59:31 +01:00
parent 2b77f5b72f
commit ceebd7b23c
4 changed files with 18 additions and 10 deletions
+5 -4
View File
@@ -91,13 +91,15 @@ abs :: proc(path: string, allocator := context.allocator) -> (string, bool) {
join :: proc(elems: ..string, allocator := context.allocator) -> string {
for e, i in elems {
if e != "" {
return join_non_empty(elems[i:])
return join_non_empty(elems[i:], allocator)
}
}
return ""
}
join_non_empty :: proc(elems: []string) -> string {
join_non_empty :: proc(elems: []string, allocator := context.allocator) -> string {
context.allocator = allocator
if len(elems[0]) == 2 && elems[0][1] == ':' {
i := 1
for ; i < len(elems); i += 1 {
@@ -110,8 +112,7 @@ join_non_empty :: proc(elems: []string) -> string {
return clean(s)
}
s := strings.join(elems, SEPARATOR_STRING, context.temp_allocator)
p := clean(s)
p := clean(strings.join(elems, SEPARATOR_STRING, context.temp_allocator))
if !is_UNC(p) {
return p
}