Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
f8121953
Commit
f8121953
authored
Oct 05, 2017
by
Tomoyuki Sahara
Committed by
GitHub
Oct 05, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #92 from palkan/master
Handle shared/frozen strings in IO#sysread
parents
04774e5b
43795cb1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
src/io.c
src/io.c
+3
-0
test/io.rb
test/io.rb
+5
-0
No files found.
src/io.c
View file @
f8121953
...
@@ -630,8 +630,11 @@ mrb_io_sysread(mrb_state *mrb, mrb_value io)
...
@@ -630,8 +630,11 @@ mrb_io_sysread(mrb_state *mrb, mrb_value io)
if
(
mrb_nil_p
(
buf
))
{
if
(
mrb_nil_p
(
buf
))
{
buf
=
mrb_str_new
(
mrb
,
NULL
,
maxlen
);
buf
=
mrb_str_new
(
mrb
,
NULL
,
maxlen
);
}
}
if
(
RSTRING_LEN
(
buf
)
!=
maxlen
)
{
if
(
RSTRING_LEN
(
buf
)
!=
maxlen
)
{
buf
=
mrb_str_resize
(
mrb
,
buf
,
maxlen
);
buf
=
mrb_str_resize
(
mrb
,
buf
,
maxlen
);
}
else
{
mrb_str_modify
(
mrb
,
RSTRING
(
buf
));
}
}
fptr
=
(
struct
mrb_io
*
)
io_get_open_fptr
(
mrb
,
io
);
fptr
=
(
struct
mrb_io
*
)
io_get_open_fptr
(
mrb
,
io
);
...
...
test/io.rb
View file @
f8121953
...
@@ -250,6 +250,11 @@ assert('IO.sysopen, IO#sysread') do
...
@@ -250,6 +250,11 @@ assert('IO.sysopen, IO#sysread') do
io
.
sysread
(
10000
)
io
.
sysread
(
10000
)
io
.
sysread
(
10000
)
io
.
sysread
(
10000
)
end
end
assert_raise
RuntimeError
do
io
.
sysread
(
5
,
"abcde"
.
freeze
)
end
io
.
close
io
.
close
assert_equal
""
,
io
.
sysread
(
0
)
assert_equal
""
,
io
.
sysread
(
0
)
assert_raise
(
IOError
)
{
io
.
sysread
(
1
)
}
assert_raise
(
IOError
)
{
io
.
sysread
(
1
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment