Ver código fonte

Fix -vet for strings

gingerBill 5 anos atrás
pai
commit
a2c50d3666
1 arquivos alterados com 8 adições e 4 exclusões
  1. 8 4
      core/strings/strings.odin

+ 8 - 4
core/strings/strings.odin

@@ -773,7 +773,8 @@ string_case_iterator :: proc(b: ^Builder, s: string, callback: proc(b: ^Builder,
 
 to_lower_camel_case :: to_camel_case;
 to_camel_case :: proc(s: string, allocator := context.allocator) -> string {
-	s := trim_space(s);
+	s := s;
+	s = trim_space(s);
 	b := make_builder(0, len(s), allocator);
 
 	string_case_iterator(&b, s, proc(b: ^Builder, prev, curr, next: rune) {
@@ -793,7 +794,8 @@ to_camel_case :: proc(s: string, allocator := context.allocator) -> string {
 
 to_upper_camel_case :: to_pascal_case;
 to_pascal_case :: proc(s: string, allocator := context.allocator) -> string {
-	s := trim_space(s);
+	s := s;
+	s = trim_space(s);
 	b := make_builder(0, len(s), allocator);
 
 	string_case_iterator(&b, s, proc(b: ^Builder, prev, curr, next: rune) {
@@ -812,7 +814,8 @@ to_pascal_case :: proc(s: string, allocator := context.allocator) -> string {
 }
 
 to_delimiter_case :: proc(s: string, delimiter: rune, all_upper_case: bool, allocator := context.allocator) -> string {
-	s := trim_space(s);
+	s := s;
+	s = trim_space(s);
 	b := make_builder(0, len(s), allocator);
 
 	adjust_case := unicode.to_upper if all_upper_case else unicode.to_lower;
@@ -868,7 +871,8 @@ to_upper_case :: proc(s: string, allocator := context.allocator) -> string {
 to_ada_case :: proc(s: string, allocator := context.allocator) -> string {
 	delimiter :: '_';
 
-	s := trim_space(s);
+	s := s;
+	s = trim_space(s);
 	b := make_builder(0, len(s), allocator);
 
 	prev, curr: rune;