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
4dac03cb
Commit
4dac03cb
authored
Jul 12, 2015
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2883 from jbreeden/array_join_nil
Patching array join
parents
39dd1822
dd558a10
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
src/array.c
src/array.c
+7
-3
No files found.
src/array.c
View file @
4dac03cb
...
...
@@ -295,7 +295,7 @@ mrb_ary_plus(mrb_state *mrb, mrb_value self)
mrb_get_args
(
mrb
,
"a"
,
&
ptr
,
&
blen
);
if
(
ARY_MAX_SIZE
-
blen
<
a1
->
len
)
{
mrb_raise
(
mrb
,
E_ARGUMENT_ERROR
,
"array size too big"
);
mrb_raise
(
mrb
,
E_ARGUMENT_ERROR
,
"array size too big"
);
}
a2
=
ary_new_capa
(
mrb
,
a1
->
len
+
blen
);
array_copy
(
a2
->
ptr
,
a1
->
ptr
,
a1
->
len
);
...
...
@@ -349,7 +349,7 @@ mrb_ary_times(mrb_state *mrb, mrb_value self)
}
if
(
times
==
0
)
return
mrb_ary_new
(
mrb
);
if
(
ARY_MAX_SIZE
/
times
<
a1
->
len
)
{
mrb_raise
(
mrb
,
E_ARGUMENT_ERROR
,
"array size too big"
);
mrb_raise
(
mrb
,
E_ARGUMENT_ERROR
,
"array size too big"
);
}
a2
=
ary_new_capa
(
mrb
,
a1
->
len
*
times
);
ptr
=
a2
->
ptr
;
...
...
@@ -1031,7 +1031,11 @@ mrb_ary_join_m(mrb_state *mrb, mrb_value ary)
{
mrb_value
sep
=
mrb_nil_value
();
mrb_get_args
(
mrb
,
"|S"
,
&
sep
);
mrb_get_args
(
mrb
,
"|o"
,
&
sep
);
if
(
!
(
mrb_nil_p
(
sep
)
||
mrb_type
(
sep
)
==
MRB_TT_STRING
))
{
mrb_raise
(
mrb
,
E_TYPE_ERROR
,
"expected String"
);
return
mrb_nil_value
();
}
return
mrb_ary_join
(
mrb
,
ary
,
sep
);
}
...
...
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