Commit graph

29 commits

Author SHA1 Message Date
U.Nakamura
4f7b595815 merge revision(s) 19346c2336: [Backport #19754]
[Bug #19754] Make `IO::Buffer#get_string` check `offset` range
	 (#8016)

	---
	 io_buffer.c                 | 3 +++
	 test/ruby/test_io_buffer.rb | 8 ++++++++
	 2 files changed, 11 insertions(+)
2023-11-06 20:18:14 +09:00
U.Nakamura
3799270ec2 merge revision(s) bd786e7896: [Backport #19084]
Fix mutation on shared strings. (#7837)

	---
	 io_buffer.c                 | 19 ++++++++++++-------
	 test/ruby/test_io_buffer.rb |  4 ----
	 2 files changed, 12 insertions(+), 11 deletions(-)
2023-07-25 20:29:45 +09:00
U.Nakamura
e7c94d9d1d merge revision(s) 09295ea796: [Backport #19543]
IO::Buffer#resize: Free internal buffer if new size is zero (#7569)

	`#resize(0)` on an IO::Buffer with internal buffer allocated will
	result in calling `realloc(data->base, 0)`. The behavior of `realloc`
	with size = 0 is implementation-defined (glibc frees the object
	and returns NULL, while BSDs return an inaccessible object). And
	thus such usage is deprecated in standard C (upcoming C23 will make it
	UB).

	To avoid this problem, just `free`s the memory when the new size is zero.
	---
	 io_buffer.c                 |  5 +++++
	 test/ruby/test_io_buffer.rb | 18 ++++++++++++++++++
	 2 files changed, 23 insertions(+)
2023-07-25 20:18:30 +09:00
nagachika
882d4203f1 merge revision(s) ef525b012a709077ea2797e8642fae0b61234063,dc9a13abeef5a2b936fbb55edc112b8b382a05e7: [Backport #18775]
Explicit handling of frozen strings in `IO::Buffer#for`. (#5892)

	---
	 io_buffer.c                 | 122 +++++++++++++++++++++++++++++++++++---------
	 test/ruby/test_io_buffer.rb |  36 +++++++------
	 2 files changed, 117 insertions(+), 41 deletions(-)

	Fix rdoc of IO::Buffer [ci skip]

	---
	 io_buffer.c | 15 +--------------
	 1 file changed, 1 insertion(+), 14 deletions(-)
2022-09-04 16:24:57 +09:00
Kazuhiro NISHIYAMA
04f07713d1
Fix typos [ci skip] 2021-12-25 10:33:49 +09:00
Samuel Williams
bed920f073
Add fiber scheduler hooks for pread/pwrite, and add support to IO::Buffer. 2021-12-23 12:20:09 +13:00
Samuel Williams
e30920354f
Extended interface for IO::Buffer & documentation. 2021-12-22 10:57:34 +13:00
Samuel Williams
617687df09 Rename IMMUTABLE to READONLY. 2021-12-21 12:25:42 +13:00
Samuel Williams
9fbf94ff04 Improve interface for get/set/copy. 2021-12-21 12:25:42 +13:00
Samuel Williams
2de5dc539b Fix handling of clear with offset and without length. 2021-12-21 12:25:42 +13:00
Samuel Williams
c86bcd434d Mark non-private mapped files as external. 2021-12-21 12:25:42 +13:00
Samuel Williams
da46b8d8e5 Default IO::Buffer#get_string to use BINARY encoding. 2021-12-21 12:25:42 +13:00
Samuel Williams
71bbc40ffa Rename to_str -> get_string and add support for encodings. 2021-12-21 12:25:42 +13:00
Samuel Williams
49166fc74a Improved exception usage/classes. 2021-12-21 12:25:42 +13:00
Samuel Williams
71bf5cef75 Fix handling of frozens strings. 2021-12-21 12:25:42 +13:00
Samuel Williams
9de5c4ec76 Fix mapping invalid non-file object. 2021-12-21 12:25:42 +13:00
Samuel Williams
56811617ab Improve IO::Buffer resize and introduce ownership transfer. 2021-12-20 00:17:17 +13:00
Samuel Williams
f3e30b26c5 Default size for IO::Buffer. 2021-12-19 12:25:38 +13:00
Samuel Williams
235f523a88 Fix spelling of DECLAIR_TYPE. 2021-12-19 00:19:55 +13:00
Nobuyoshi Nakada
d2cb4cc073
Adjust format 2021-11-21 16:16:03 +09:00
Samuel Williams
5190926e40 Validate string type when constructing IO::Buffer for string mapping. 2021-11-17 10:39:54 +13:00
Samuel Williams
a19a657514 Fix 32-bit conversions in IO::Buffer implementation. 2021-11-17 10:39:41 +13:00
Samuel Williams
c833ece5f7 Rework implementation of IO::Buffer.for(string) to use string locking. 2021-11-12 16:46:08 +13:00
Samuel Williams
98b442e013 More immutability and locking tests. 2021-11-12 16:46:08 +13:00
Nobuyoshi Nakada
4eb23c9dda
Commit miss [ci skip] 2021-11-10 17:47:12 +09:00
Nobuyoshi Nakada
943b6e4d9c
Fix format specifier 2021-11-10 17:07:58 +09:00
Nobuyoshi Nakada
46e46eafd4
size_t is not for file size 2021-11-10 16:41:26 +09:00
Samuel Williams
81d0ce7e97 Mark IO::Buffer as experimental. 2021-11-10 19:21:05 +13:00
Samuel Williams
4b89034218 IO::Buffer for scheduler interface. 2021-11-10 19:21:05 +13:00