Make the string type elements "immutable", akin to char const * in C

Allows for extra security and optimization benefits
This commit is contained in:
gingerBill
2019-12-01 14:10:59 +00:00
parent 7fbe0a6f23
commit 9db81498d8
25 changed files with 255 additions and 176 deletions
+7 -7
View File
@@ -95,17 +95,17 @@ marshal_arg :: proc(b: ^strings.Builder, v: any) -> Marshal_Error {
buf: [386]byte;
str := strconv.append_float(buf[1:], val, 'f', 2*ti.size, 8*ti.size);
str = string(buf[:len(str)+1]);
if str[1] == '+' || str[1] == '-' {
str = str[1:];
s := buf[:len(str)+1];
if s[1] == '+' || s[1] == '-' {
s = s[1:];
} else {
str[0] = '+';
s[0] = '+';
}
if str[0] == '+' {
str = str[1:];
if s[0] == '+' {
s = s[1:];
}
write_string(b, str);
write_string(b, string(s));
case Type_Info_Complex:
return Marshal_Error.Unsupported_Type;