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
4a84fa5d
Unverified
Commit
4a84fa5d
authored
Nov 23, 2021
by
Yukihiro "Matz" Matsumoto
Committed by
GitHub
Nov 23, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5580 from dearblue/static-proc
Fixed occurs `SIGSEGV` with `mrbgems/mruby-method`
parents
01cadd3e
b02bd63d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
19 deletions
+7
-19
mrbgems/mruby-method/src/method.c
mrbgems/mruby-method/src/method.c
+6
-18
mrbgems/mruby-proc-ext/src/proc.c
mrbgems/mruby-proc-ext/src/proc.c
+1
-1
No files found.
mrbgems/mruby-method/src/method.c
View file @
4a84fa5d
...
...
@@ -9,6 +9,10 @@
mrb_noreturn
void
mrb_method_missing
(
mrb_state
*
mrb
,
mrb_sym
name
,
mrb_value
self
,
mrb_value
args
);
mrb_value
mrb_exec_irep
(
mrb_state
*
mrb
,
mrb_value
self
,
struct
RProc
*
p
);
// Defined by mruby-proc-ext on which mruby-method depends
mrb_value
mrb_proc_parameters
(
mrb_state
*
mrb
,
mrb_value
proc
);
mrb_value
mrb_proc_source_location
(
mrb_state
*
mrb
,
struct
RProc
*
p
);
static
mrb_value
args_shift
(
mrb_state
*
mrb
)
{
...
...
@@ -345,28 +349,17 @@ static mrb_value
method_source_location
(
mrb_state
*
mrb
,
mrb_value
self
)
{
mrb_value
proc
=
mrb_iv_get
(
mrb
,
self
,
MRB_SYM
(
_proc
));
struct
RProc
*
rproc
;
struct
RClass
*
orig
;
mrb_value
ret
;
if
(
mrb_nil_p
(
proc
))
return
mrb_nil_value
();
rproc
=
mrb_proc_ptr
(
proc
);
orig
=
rproc
->
c
;
rproc
->
c
=
mrb
->
proc_class
;
ret
=
mrb_funcall_id
(
mrb
,
proc
,
MRB_SYM
(
source_location
),
0
);
rproc
->
c
=
orig
;
return
ret
;
return
mrb_proc_source_location
(
mrb
,
mrb_proc_ptr
(
proc
));
}
static
mrb_value
method_parameters
(
mrb_state
*
mrb
,
mrb_value
self
)
{
mrb_value
proc
=
mrb_iv_get
(
mrb
,
self
,
MRB_SYM
(
_proc
));
struct
RProc
*
rproc
;
struct
RClass
*
orig
;
mrb_value
ret
;
if
(
mrb_nil_p
(
proc
))
{
mrb_value
rest
=
mrb_symbol_value
(
MRB_SYM
(
rest
));
...
...
@@ -374,12 +367,7 @@ method_parameters(mrb_state *mrb, mrb_value self)
return
mrb_ary_new_from_values
(
mrb
,
1
,
&
arest
);
}
rproc
=
mrb_proc_ptr
(
proc
);
orig
=
rproc
->
c
;
rproc
->
c
=
mrb
->
proc_class
;
ret
=
mrb_funcall_id
(
mrb
,
proc
,
MRB_SYM
(
parameters
),
0
);
rproc
->
c
=
orig
;
return
ret
;
return
mrb_proc_parameters
(
mrb
,
proc
);
}
static
mrb_value
...
...
mrbgems/mruby-proc-ext/src/proc.c
View file @
4a84fa5d
...
...
@@ -92,7 +92,7 @@ mrb_kernel_proc(mrb_state *mrb, mrb_value self)
* prc.parameters #=> [[:req, :x], [:opt, :y], [:rest, :other]]
*/
static
mrb_value
mrb_value
mrb_proc_parameters
(
mrb_state
*
mrb
,
mrb_value
self
)
{
struct
parameters_type
{
...
...
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