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
e18a9c0a
Commit
e18a9c0a
authored
Jan 29, 2013
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #788 from masamitsu-murase/modify_range_initialize
Modify range initialize to prevent segmentation fault.
parents
14c97e82
7941dfb4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
9 deletions
+8
-9
src/range.c
src/range.c
+1
-1
test/t/range.rb
test/t/range.rb
+7
-8
No files found.
src/range.c
View file @
e18a9c0a
...
...
@@ -43,8 +43,8 @@ mrb_range_new(mrb_state *mrb, mrb_value beg, mrb_value end, int excl)
struct
RRange
*
r
;
r
=
(
struct
RRange
*
)
mrb_obj_alloc
(
mrb
,
MRB_TT_RANGE
,
RANGE_CLASS
);
r
->
edges
=
(
struct
mrb_range_edges
*
)
mrb_malloc
(
mrb
,
sizeof
(
struct
mrb_range_edges
));
range_check
(
mrb
,
beg
,
end
);
r
->
edges
=
(
struct
mrb_range_edges
*
)
mrb_malloc
(
mrb
,
sizeof
(
struct
mrb_range_edges
));
r
->
edges
->
beg
=
beg
;
r
->
edges
->
end
=
end
;
r
->
excl
=
excl
;
...
...
test/t/range.rb
View file @
e18a9c0a
...
...
@@ -48,14 +48,13 @@ assert('Range#include', '15.2.14.4.8') do
a
.
include?
(
5
)
and
not
a
.
include?
(
20
)
end
# TODO SEGFAULT ATM
#assert('Range#initialize', '15.2.14.4.9') do
# a = Range.new(1, 10, true)
# b = Range.new(1, 10, false)
#
# a == (1..10) and a.exclude_end? and b == (1..10) and
# not b.exclude_end?
#end
assert
(
'Range#initialize'
,
'15.2.14.4.9'
)
do
a
=
Range
.
new
(
1
,
10
,
true
)
b
=
Range
.
new
(
1
,
10
,
false
)
a
==
(
1
...
10
)
and
a
.
exclude_end?
and
b
==
(
1
..
10
)
and
not
b
.
exclude_end?
end
assert
(
'Range#last'
,
'15.2.14.4.10'
)
do
(
1
..
10
).
last
==
10
...
...
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