Remove usage of do in core library

This commit is contained in:
gingerBill
2020-09-23 17:17:14 +01:00
parent 4844dd4d96
commit fc4fdd588e
45 changed files with 960 additions and 520 deletions
+2 -2
View File
@@ -131,7 +131,7 @@ write_quoted_string :: proc(b: ^Builder, str: string, quote: byte = '"') {
write_encoded_rune :: proc(b: ^Builder, r: rune, write_quote := true) {
if write_quote do write_byte(b, '\'');
if write_quote { write_byte(b, '\''); }
switch r {
case '\a': write_string(b, `\a"`);
case '\b': write_string(b, `\b"`);
@@ -156,7 +156,7 @@ write_encoded_rune :: proc(b: ^Builder, r: rune, write_quote := true) {
}
}
if write_quote do write_byte(b, '\'');
if write_quote { write_byte(b, '\''); }
}
+9 -3
View File
@@ -40,7 +40,9 @@ compare :: proc(lhs, rhs: string) -> int {
contains_rune :: proc(s: string, r: rune) -> int {
for c, offset in s {
if c == r do return offset;
if c == r {
return offset;
}
}
return -1;
}
@@ -216,7 +218,9 @@ split_after_n :: inline proc(s, sep: string, n: int, allocator := context.alloca
index_byte :: proc(s: string, c: byte) -> int {
for i := 0; i < len(s); i += 1 {
if s[i] == c do return i;
if s[i] == c {
return i;
}
}
return -1;
}
@@ -224,7 +228,9 @@ index_byte :: proc(s: string, c: byte) -> int {
// Returns i1 if c is not present
last_index_byte :: proc(s: string, c: byte) -> int {
for i := len(s)-1; i >= 0; i -= 1 {
if s[i] == c do return i;
if s[i] == c {
return i;
}
}
return -1;
}