mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-28 18:30:06 +00:00
Remove usage of do in core library
This commit is contained in:
@@ -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, '\''); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user