Commit Graph

61 Commits

Author SHA1 Message Date
Karl Zylinski 679f9b4e41 Made default capacity of dynamic arrays more consistent.
Before this if you do `arr: [dynamic]int` and then append to arr, then it will have capacity 8.
But if you did `arr := make([dynamic]int, context.temp_allocator)` then arr would have capacity 16.

Now both `arr: [dynamic]int` and `arr := make([dynamic]int, context.temp_allocator)` will resut in arr having zero 0. The only reason to use `make` without an explicit len or cap now is because you want to set it up for a non-default allocator. After the first call to `append` it will now in both cases have capacity 8.

I also updated the documentation on the strings builder, both to reflect this, and also to fix it incorrectly saying that len would be 'max(16,len)', which wasn't true even before these changes.
2024-06-29 08:57:21 +02:00
gingerBill 853173a11b Merge pull request #3517 from timosperisen/patch-1
Update builder.odin
2024-06-28 12:00:23 +01:00
Justin Snyder 1a6bb59125 drop unnecessary defer 2024-06-19 18:25:42 -06:00
Justin Snyder 271782d2f4 fix typo
apparently i had a moment of dyslexia
2024-06-19 17:53:34 -06:00
Justin Snyder 1b7c4c2efe trim added null byte 2024-06-19 17:35:16 -06:00
Justin Snyder 8f2c4a7ecf Add builder to_cstring 2024-06-19 11:55:19 -06:00
Jeroen van Rijn a27b167218 Update tests\core\encoding\cbor to use new test runner.
It was leaky and required a substantial number of `loc := #caller_location` additions to parts of the core library to make it easier to track down how and where it leaked.

The tests now run fine multi-threaded.
2024-06-02 14:47:07 -04:00
Timo 2918baa3e8 Update builder.odin
Modify documentation-text for procedure write_f64 :

change type f32 to f64
2024-04-29 20:22:53 +02:00
gingerBill 3e7e779abf Replace core:* to base:* where appropriate 2024-01-28 22:18:51 +00:00
Pix 0cf9c22033 Builder makes added caller location 2023-08-15 12:30:40 +08:00
gingerBill 3f6775e29b Update to new io interface 2023-06-08 16:35:24 +01:00
Jon Lipstate f9b5f2b7b1 update builder sample 2023-04-26 18:04:24 -07:00
Jon Lipstate 67fa5df89c fix typo, add builder sample 2023-04-26 18:00:14 -07:00
Lucas Perlind e0d9092df8 Document return values of strings and add allocator errors where
possible
2023-04-07 20:39:01 +10:00
Lucas Perlind 67e6f57192 Small improvements strings documentation
* Use new 'Returns:' and 'Inputs:' keywords used by the website generator
* Make order item order resemble website, i.e. 'Returns:' comes before
  'Example:'
* Add a few missing input items
* Add a few missing return items
2023-04-03 08:44:14 +10:00
Lucas Perlind 6ff0cc0b40 Enforce example names in documentation 2023-04-01 09:13:15 +11:00
Lucas Perlind 84d8798ad3 Fix website formatting and incorrect examples 2023-03-29 12:19:05 +11:00
Jon Lipstate 203ae32b79 pr pickups 2023-03-28 10:24:41 -07:00
Jon Lipstate 7de67f8c1b markdown compliant spaces 2023-03-27 22:20:24 -07:00
Jon Lipstate f5d66bcb6f transform into odin-site parsable format 2023-03-27 22:00:53 -07:00
Jon Lipstate bf82c40964 string code docs 2023-03-27 20:09:51 -07:00
gingerBill e05944601a Minor fixes 2023-03-16 13:35:38 +00:00
Jeroen van Rijn 677e7ff642 Don't write leading + unless +Inf or we ask for it. 2022-11-14 16:32:50 +01:00
gingerBill ab00db2ebd Add write_(f16|f32|f64) calls 2022-11-14 12:37:55 +00:00
Colin Davidson 0a0e8f36eb add floats to string builder 2022-11-14 04:30:14 -08:00
gingerBill f50fc33749 Clean up of the core library to make the stream vtables not be pointers directly. 2022-09-15 10:00:50 +01:00
gingerBill c90b7c38f1 Rename strings.Builder procedures to be consistent with the rest of the core library 2022-07-11 11:50:08 +01:00
gingerBill fb49841b1d Remove strings dependency from core:sys/windows 2022-06-02 13:02:16 +01:00
gingerBill 33895b6d92 Convert all uses of *_from_slice to *_from_bytes where appropriate 2022-05-16 01:43:43 +01:00
Michael Kutowski b5aa50aaa4 documentation for the rest of the strings library 2022-04-03 19:37:54 +02:00
gingerBill 6ca793f0e9 Remove deprecation from the build specific procedures 2021-09-30 11:45:56 +01:00
gingerBill e928793e79 Correct _builder_stream_vtable 2021-09-29 14:49:06 +01:00
gingerBill 94a27224b2 Deprecate strings.write_quoted_* in favour of io.write_quoted_*; make reflect.write_type a little more robust with io.Error handling 2021-09-29 13:42:58 +01:00
gingerBill b2164b5da6 Make the io/conv.odin utilities be #optional_ok 2021-09-29 13:24:42 +01:00
gingerBill b3f2263442 Add io.write_quoted_* utility procedures to package io 2021-09-29 13:04:59 +01:00
gingerBill 56bd1e2d70 Simplify strings.write_byte and strings.write_bytes 2021-09-09 00:38:16 +01:00
gingerBill 251da264ed Remove unneeded semicolons from the core library 2021-08-31 22:21:13 +01:00
gingerBill 86649e6b44 Core library clean up: Make range expressions more consistent and replace uses of .. with ..= 2021-06-14 11:15:25 +01:00
gingerBill 26ce40c188 Remove @(static) for global variables 2021-05-19 11:51:48 +01:00
gingerBill b727b6438b Minimize unneeded casts 2021-03-03 14:31:17 +00:00
gingerBill 5d0db4c63a Clean up fmt usage with io.Writer and strings.Builder 2020-12-04 15:04:54 +00:00
gingerBill 0ef02e6737 Improve packages io and strings; add io.Section_Reader 2020-12-03 15:57:46 +00:00
gingerBill 18da0b3418 Integrate package io into core library 2020-12-03 10:45:26 +00:00
gingerBill c4172e3914 Rename stream field names 2020-12-02 23:17:21 +00:00
gingerBill fef5172278 Add %q for runes in fmt 2020-11-18 23:40:54 +00:00
gingerBill e83af93394 Allow flushing with strings.Builder; Make fmt.fprint* procedures use a custom flush procedure 2020-10-01 12:03:20 +01:00
gingerBill fc4fdd588e Remove usage of do in core library 2020-09-23 17:17:14 +01:00
gingerBill 5b7c83d871 Add strings.pop_byte strings.pop_rune 2020-07-08 23:15:48 +01:00
gingerBill f06efffe22 Update strings case convertors to be unicode compliant 2020-05-24 17:50:27 +01:00
gingerBill 9db81498d8 Make the string type elements "immutable", akin to char const * in C
Allows for extra security and optimization benefits
2019-12-01 14:10:59 +00:00