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
+15 -5
View File
@@ -90,7 +90,9 @@ encode_rune :: proc(c: rune) -> ([4]u8, int) {
return buf, 4;
}
decode_rune_in_string :: inline proc(s: string) -> (rune, int) do return decode_rune(transmute([]u8)s);
decode_rune_in_string :: inline proc(s: string) -> (rune, int) {
return decode_rune(transmute([]u8)s);
}
decode_rune :: proc(s: []u8) -> (rune, int) {
n := len(s);
if n < 1 {
@@ -159,7 +161,9 @@ runes_to_string :: proc(runes: []rune, allocator := context.allocator) -> string
}
decode_last_rune_in_string :: inline proc(s: string) -> (rune, int) do return decode_last_rune(transmute([]u8)s);
decode_last_rune_in_string :: inline proc(s: string) -> (rune, int) {
return decode_last_rune(transmute([]u8)s);
}
decode_last_rune :: proc(s: []u8) -> (rune, int) {
r: rune;
size: int;
@@ -179,7 +183,9 @@ decode_last_rune :: proc(s: []u8) -> (rune, int) {
limit = max(end - UTF_MAX, 0);
for start-=1; start >= limit; start-=1 {
if rune_start(s[start]) do break;
if rune_start(s[start]) {
break;
}
}
start = max(start, 0);
@@ -287,9 +293,13 @@ valid_string :: proc(s: string) -> bool {
return true;
}
rune_start :: inline proc(b: u8) -> bool do return b&0xc0 != 0x80;
rune_start :: inline proc(b: u8) -> bool {
return b&0xc0 != 0x80;
}
rune_count_in_string :: inline proc(s: string) -> int do return rune_count(transmute([]u8)s);
rune_count_in_string :: inline proc(s: string) -> int {
return rune_count(transmute([]u8)s);
}
rune_count :: proc(s: []u8) -> int {
count := 0;
n := len(s);