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
83992ee1
Commit
83992ee1
authored
Oct 02, 2014
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cast MRB_ENV_STACK_LEN to (mrb_int); ref #2600
parent
906b62d5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
5 deletions
+9
-5
include/mruby/proc.h
include/mruby/proc.h
+2
-1
mrbgems/default.gembox
mrbgems/default.gembox
+3
-0
src/gc.c
src/gc.c
+2
-2
src/proc.c
src/proc.c
+2
-2
No files found.
include/mruby/proc.h
View file @
83992ee1
...
...
@@ -20,7 +20,8 @@ struct REnv {
ptrdiff_t
cioff
;
};
#define MRB_ENV_STACK_LEN(e) ((e)->flags)
#define MRB_SET_ENV_STACK_LEN(e,len) (e)->flags = (unsigned int)(len)
#define MRB_ENV_STACK_LEN(e) ((mrb_int)(e)->flags)
#define MRB_ENV_UNSHARE_STACK(e) ((e)->cioff = -1)
#define MRB_ENV_STACK_SHARED_P(e) ((e)->cioff >= 0)
...
...
mrbgems/default.gembox
View file @
83992ee1
...
...
@@ -70,4 +70,7 @@ MRuby::GemBox.new do |conf|
# Use extensional Kernel module
conf.gem :core => "mruby-kernel-ext"
# Use extensional Kernel module
conf.gem :github => "matz/mruby-thread"
end
src/gc.c
View file @
83992ee1
...
...
@@ -532,9 +532,9 @@ gc_mark_children(mrb_state *mrb, struct RBasic *obj)
struct
REnv
*
e
=
(
struct
REnv
*
)
obj
;
if
(
!
MRB_ENV_STACK_SHARED_P
(
e
))
{
int
i
,
len
;
mrb_
int
i
,
len
;
len
=
(
int
)
MRB_ENV_STACK_LEN
(
e
);
len
=
MRB_ENV_STACK_LEN
(
e
);
for
(
i
=
0
;
i
<
len
;
i
++
)
{
mrb_gc_mark_value
(
mrb
,
e
->
stack
[
i
]);
}
...
...
src/proc.c
View file @
83992ee1
...
...
@@ -40,7 +40,7 @@ env_new(mrb_state *mrb, int nlocals)
struct
REnv
*
e
;
e
=
(
struct
REnv
*
)
mrb_obj_alloc
(
mrb
,
MRB_TT_ENV
,
(
struct
RClass
*
)
mrb
->
c
->
ci
->
proc
->
env
);
MRB_
ENV_STACK_LEN
(
e
)
=
(
unsigned
int
)
nlocals
;
MRB_
SET_ENV_STACK_LEN
(
e
,
nlocals
)
;
e
->
mid
=
mrb
->
c
->
ci
->
mid
;
e
->
cioff
=
mrb
->
c
->
ci
-
mrb
->
c
->
cibase
;
e
->
stack
=
mrb
->
c
->
stack
;
...
...
@@ -126,7 +126,7 @@ mrb_proc_cfunc_env_get(mrb_state *mrb, mrb_int idx)
if
(
!
e
)
{
mrb_raise
(
mrb
,
E_TYPE_ERROR
,
"Can't get cfunc env from cfunc Proc without REnv."
);
}
if
(
idx
<
0
||
(
mrb_int
)
MRB_ENV_STACK_LEN
(
e
)
<=
idx
)
{
if
(
idx
<
0
||
MRB_ENV_STACK_LEN
(
e
)
<=
idx
)
{
mrb_raisef
(
mrb
,
E_INDEX_ERROR
,
"Env index out of range: %S (expected: 0 <= index < %S)"
,
mrb_fixnum_value
(
idx
),
mrb_fixnum_value
(
MRB_ENV_STACK_LEN
(
e
)));
}
...
...
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