From c90b7c38f1a54e1f6bc144bea76b976f7c126644 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 11 Jul 2022 11:50:08 +0100 Subject: Rename strings.Builder procedures to be consistent with the rest of the core library --- core/encoding/entity/entity.odin | 8 ++++---- core/encoding/json/marshal.odin | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'core/encoding') diff --git a/core/encoding/entity/entity.odin b/core/encoding/entity/entity.odin index e5831a75f..694fcdffc 100644 --- a/core/encoding/entity/entity.odin +++ b/core/encoding/entity/entity.odin @@ -25,8 +25,8 @@ import "core:strings" MAX_RUNE_CODEPOINT :: int(unicode.MAX_RUNE) -write_rune :: strings.write_rune_builder -write_string :: strings.write_string_builder +write_rune :: strings.write_rune +write_string :: strings.write_string Error :: enum u8 { None = 0, @@ -94,8 +94,8 @@ decode_xml :: proc(input: string, options := XML_Decode_Options{}, allocator := l := len(input) if l == 0 { return "", .None } - builder := strings.make_builder() - defer strings.destroy_builder(&builder) + builder := strings.builder_make() + defer strings.builder_destroy(&builder) t := Tokenizer{src=input} in_data := false diff --git a/core/encoding/json/marshal.odin b/core/encoding/json/marshal.odin index 14df4c127..54fab44c6 100644 --- a/core/encoding/json/marshal.odin +++ b/core/encoding/json/marshal.odin @@ -18,9 +18,9 @@ Marshal_Error :: union #shared_nil { } marshal :: proc(v: any, allocator := context.allocator) -> (data: []byte, err: Marshal_Error) { - b := strings.make_builder(allocator) + b := strings.builder_make(allocator) defer if err != nil { - strings.destroy_builder(&b) + strings.builder_destroy(&b) } marshal_to_builder(&b, v) or_return -- cgit v1.2.3 From ae9d540c1c77bfc84a4fff964e218aebcb0c2680 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 11 Jul 2022 11:55:49 +0100 Subject: Correct naming in tests --- core/encoding/entity/example/entity_example.odin | 2 +- core/encoding/xml/example/xml_example.odin | 2 +- core/unicode/tools/generate_entity_table.odin | 2 +- tests/core/encoding/varint/test_core_varint.odin | 6 +++--- tests/core/encoding/xml/test_core_xml.odin | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) (limited to 'core/encoding') diff --git a/core/encoding/entity/example/entity_example.odin b/core/encoding/entity/example/entity_example.odin index 6fc377f9d..6301eb263 100644 --- a/core/encoding/entity/example/entity_example.odin +++ b/core/encoding/entity/example/entity_example.odin @@ -8,7 +8,7 @@ import "core:time" doc_print :: proc(doc: ^xml.Document) { buf: strings.Builder - defer strings.destroy_builder(&buf) + defer strings.builder_destroy(&buf) w := strings.to_writer(&buf) xml.print(w, doc) diff --git a/core/encoding/xml/example/xml_example.odin b/core/encoding/xml/example/xml_example.odin index f7e74840e..887b40764 100644 --- a/core/encoding/xml/example/xml_example.odin +++ b/core/encoding/xml/example/xml_example.odin @@ -84,7 +84,7 @@ example :: proc() { doc_hash :: proc(doc: ^xml.Document, print := false) -> (crc32: u32) { buf: strings.Builder - defer strings.destroy_builder(&buf) + defer strings.builder_destroy(&buf) w := strings.to_writer(&buf) xml.print(w, doc) diff --git a/core/unicode/tools/generate_entity_table.odin b/core/unicode/tools/generate_entity_table.odin index 075ec1cca..328ba9091 100644 --- a/core/unicode/tools/generate_entity_table.odin +++ b/core/unicode/tools/generate_entity_table.odin @@ -45,7 +45,7 @@ generate_encoding_entity_table :: proc() { printf("\"%v\" loaded and parsed.\n", filename) generated_buf: strings.Builder - defer strings.destroy_builder(&generated_buf) + defer strings.builder_destroy(&generated_buf) w := strings.to_writer(&generated_buf) charlist, charlist_ok := xml.find_child_by_ident(doc.root, "charlist") diff --git a/tests/core/encoding/varint/test_core_varint.odin b/tests/core/encoding/varint/test_core_varint.odin index 2c3669afa..ee1798aa7 100644 --- a/tests/core/encoding/varint/test_core_varint.odin +++ b/tests/core/encoding/varint/test_core_varint.odin @@ -79,8 +79,8 @@ test_leb128 :: proc(t: ^testing.T) { } } - for num_bytes in 1..uint(16) { - for _ in 0..RANDOM_TESTS { + for num_bytes in 1..=uint(16) { + for _ in 0..=RANDOM_TESTS { unsigned, signed := get_random(num_bytes) { @@ -109,7 +109,7 @@ test_leb128 :: proc(t: ^testing.T) { get_random :: proc(byte_count: uint) -> (u: u128, i: i128) { assert(byte_count >= 0 && byte_count <= size_of(u128)) - for _ in 1..byte_count { + for _ in 1..=byte_count { u <<= 8 u |= u128(rand.uint32() & 0xff) } diff --git a/tests/core/encoding/xml/test_core_xml.odin b/tests/core/encoding/xml/test_core_xml.odin index a17594b7e..3cfc75a65 100644 --- a/tests/core/encoding/xml/test_core_xml.odin +++ b/tests/core/encoding/xml/test_core_xml.odin @@ -281,7 +281,7 @@ doc_to_string :: proc(doc: ^xml.Document) -> (result: string) { } buf: strings.Builder - defer strings.destroy_builder(&buf) + defer strings.builder_destroy(&buf) print(strings.to_writer(&buf), doc) return strings.clone(strings.to_string(buf)) -- cgit v1.2.3