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
9fc26eac
Unverified
Commit
9fc26eac
authored
Dec 31, 2021
by
Yukihiro "Matz" Matsumoto
Committed by
GitHub
Dec 31, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5619 from dearblue/properties
Get object properties after `mrb_get_args()`
parents
b9e1b9b3
a137ef12
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
7 deletions
+15
-7
mrbgems/mruby-array-ext/src/array.c
mrbgems/mruby-array-ext/src/array.c
+8
-4
src/string.c
src/string.c
+7
-3
No files found.
mrbgems/mruby-array-ext/src/array.c
View file @
9fc26eac
...
...
@@ -264,12 +264,14 @@ mrb_ary_compact_bang(mrb_state *mrb, mrb_value self)
static
mrb_value
mrb_ary_rotate
(
mrb_state
*
mrb
,
mrb_value
self
)
{
mrb_int
count
=
1
;
mrb_get_args
(
mrb
,
"|i"
,
&
count
);
mrb_value
ary
=
mrb_ary_new
(
mrb
);
mrb_int
len
=
RARRAY_LEN
(
self
);
mrb_value
*
p
=
RARRAY_PTR
(
self
);
mrb_int
count
=
1
,
idx
;
mrb_int
idx
;
mrb_get_args
(
mrb
,
"|i"
,
&
count
);
if
(
len
<=
0
)
return
ary
;
if
(
count
<
0
)
{
idx
=
len
-
(
~
count
%
len
)
-
1
;
...
...
@@ -313,12 +315,14 @@ rev(mrb_value *p, mrb_int beg, mrb_int end)
static
mrb_value
mrb_ary_rotate_bang
(
mrb_state
*
mrb
,
mrb_value
self
)
{
mrb_int
count
=
1
;
mrb_get_args
(
mrb
,
"|i"
,
&
count
);
struct
RArray
*
a
=
mrb_ary_ptr
(
self
);
mrb_int
len
=
ARY_LEN
(
a
);
mrb_value
*
p
=
ARY_PTR
(
a
);
mrb_int
count
=
1
,
idx
;
mrb_int
idx
;
mrb_get_args
(
mrb
,
"|i"
,
&
count
);
mrb_ary_modify
(
mrb
,
a
);
if
(
len
==
0
||
count
==
0
)
return
self
;
if
(
count
==
1
)
{
...
...
src/string.c
View file @
9fc26eac
...
...
@@ -2038,9 +2038,11 @@ static mrb_value
mrb_str_rindex
(
mrb_state
*
mrb
,
mrb_value
str
)
{
mrb_value
sub
;
mrb_int
pos
,
len
=
RSTRING_CHAR_LEN
(
str
);
mrb_int
pos
;
int
argc
=
mrb_get_args
(
mrb
,
"S|i"
,
&
sub
,
&
pos
);
mrb_int
len
=
RSTRING_CHAR_LEN
(
str
);
if
(
mrb_get_args
(
mrb
,
"S|i"
,
&
sub
,
&
pos
)
==
1
)
{
if
(
argc
==
1
)
{
pos
=
len
;
}
else
{
...
...
@@ -2819,16 +2821,18 @@ static mrb_value
mrb_str_byteslice
(
mrb_state
*
mrb
,
mrb_value
str
)
{
mrb_value
a1
;
mrb_int
str_len
=
RSTRING_LEN
(
str
)
,
beg
,
len
;
mrb_int
str_len
,
beg
,
len
;
mrb_bool
empty
=
TRUE
;
len
=
mrb_get_argc
(
mrb
);
switch
(
len
)
{
case
2
:
mrb_get_args
(
mrb
,
"ii"
,
&
beg
,
&
len
);
str_len
=
RSTRING_LEN
(
str
);
break
;
case
1
:
a1
=
mrb_get_arg1
(
mrb
);
str_len
=
RSTRING_LEN
(
str
);
if
(
mrb_range_p
(
a1
))
{
if
(
mrb_range_beg_len
(
mrb
,
a1
,
&
beg
,
&
len
,
str_len
,
TRUE
)
!=
MRB_RANGE_OK
)
{
return
mrb_nil_value
();
...
...
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