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
694089fa
Commit
694089fa
authored
Dec 09, 2019
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix `mrb_get_argv()` to return array pointer every time; fix #4832
parent
fb9e92e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
src/class.c
src/class.c
+12
-10
No files found.
src/class.c
View file @
694089fa
...
@@ -542,15 +542,12 @@ MRB_API mrb_value*
...
@@ -542,15 +542,12 @@ MRB_API mrb_value*
mrb_get_argv
(
mrb_state
*
mrb
)
mrb_get_argv
(
mrb_state
*
mrb
)
{
{
mrb_int
argc
=
mrb
->
c
->
ci
->
argc
;
mrb_int
argc
=
mrb
->
c
->
ci
->
argc
;
mrb_value
*
array_argv
;
mrb_value
*
array_argv
=
mrb
->
c
->
stack
+
1
;
if
(
argc
<
0
)
{
if
(
argc
<
0
)
{
struct
RArray
*
a
=
mrb_ary_ptr
(
mrb
->
c
->
stack
[
1
]
);
struct
RArray
*
a
=
mrb_ary_ptr
(
*
array_argv
);
array_argv
=
ARY_PTR
(
a
);
array_argv
=
ARY_PTR
(
a
);
}
}
else
{
array_argv
=
NULL
;
}
return
array_argv
;
return
array_argv
;
}
}
...
@@ -594,9 +591,10 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
...
@@ -594,9 +591,10 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
char
c
;
char
c
;
mrb_int
i
=
0
;
mrb_int
i
=
0
;
va_list
ap
;
va_list
ap
;
mrb_int
argc
=
mrb_get_argc
(
mrb
);
mrb_int
arg_i
=
0
;
mrb_int
arg_i
=
0
;
mrb_value
*
array_argv
=
mrb_get_argv
(
mrb
);
mrb_int
argc
=
mrb
->
c
->
ci
->
argc
;
mrb_value
*
array_argv
=
mrb
->
c
->
stack
+
1
;
mrb_bool
argv_on_stack
=
argc
>=
0
;
mrb_bool
opt
=
FALSE
;
mrb_bool
opt
=
FALSE
;
mrb_bool
opt_skip
=
TRUE
;
mrb_bool
opt_skip
=
TRUE
;
mrb_bool
given
=
TRUE
;
mrb_bool
given
=
TRUE
;
...
@@ -604,10 +602,14 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
...
@@ -604,10 +602,14 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
mrb_bool
reqkarg
=
FALSE
;
mrb_bool
reqkarg
=
FALSE
;
mrb_int
needargc
=
0
;
mrb_int
needargc
=
0
;
if
(
!
argv_on_stack
)
{
struct
RArray
*
a
=
mrb_ary_ptr
(
*
array_argv
);
array_argv
=
ARY_PTR
(
a
);
argc
=
ARY_LEN
(
a
);
}
va_start
(
ap
,
format
);
va_start
(
ap
,
format
);
#define ARGV \
#define ARGV array_argv
(array_argv ? array_argv : (mrb->c->stack + 1))
while
((
c
=
*
fmt
++
))
{
while
((
c
=
*
fmt
++
))
{
switch
(
c
)
{
switch
(
c
)
{
...
@@ -931,7 +933,7 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
...
@@ -931,7 +933,7 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
{
{
mrb_value
**
var
;
mrb_value
**
var
;
mrb_int
*
pl
;
mrb_int
*
pl
;
mrb_bool
nocopy
=
altmode
||
ar
ray_argv
?
TRUE
:
FALSE
;
mrb_bool
nocopy
=
altmode
||
ar
gv_on_stack
?
TRUE
:
FALSE
;
var
=
va_arg
(
ap
,
mrb_value
**
);
var
=
va_arg
(
ap
,
mrb_value
**
);
pl
=
va_arg
(
ap
,
mrb_int
*
);
pl
=
va_arg
(
ap
,
mrb_int
*
);
...
...
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