diff options
| author | gingerBill <bill@gingerbill.org> | 2019-12-01 14:10:59 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2019-12-01 14:10:59 +0000 |
| commit | 9db81498d8fbf4b24383cd7de94619943ad4e01a (patch) | |
| tree | 6263d1649607f44a1d8affc2baf1d39da906698f /core/encoding/cel | |
| parent | 7fbe0a6f2385e618ea4d3a724d2ed6147b6921bf (diff) | |
Make the `string` type elements "immutable", akin to `char const *` in C
Allows for extra security and optimization benefits
Diffstat (limited to 'core/encoding/cel')
| -rw-r--r-- | core/encoding/cel/cel.odin | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/encoding/cel/cel.odin b/core/encoding/cel/cel.odin index 754d8cbfa..fe36978c2 100644 --- a/core/encoding/cel/cel.odin +++ b/core/encoding/cel/cel.odin @@ -91,7 +91,7 @@ print :: proc(p: ^Parser, pretty := false) { } create_from_string :: proc(src: string) -> (^Parser, bool) { - return init(cast([]byte)src); + return init(transmute([]byte)src); } @@ -726,8 +726,8 @@ calculate_binary_value :: proc(p: ^Parser, op: Kind, a, b: Value) -> (Value, boo case Kind.Add: n := len(a) + len(b); data := make([]byte, n); - copy(data[:], cast([]byte)a); - copy(data[len(a):], cast([]byte)b); + copy(data[:], a); + copy(data[len(a):], b); s := string(data); append(&p.allocated_strings, s); return s, true; |