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
167a747a
Unverified
Commit
167a747a
authored
Jun 20, 2020
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Constify `irep` struct for `Class#new`.
parent
cfc958b0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
16 deletions
+9
-16
src/class.c
src/class.c
+9
-16
No files found.
src/class.c
View file @
167a747a
...
@@ -2309,27 +2309,20 @@ static const mrb_code new_iseq[] = {
...
@@ -2309,27 +2309,20 @@ static const mrb_code new_iseq[] = {
OP_RETURN
,
0x0
/* OP_RETURN R0 */
OP_RETURN
,
0x0
/* OP_RETURN R0 */
};
};
const
mrb_sym
new_syms
[]
=
{
MRB_SYM
(
allocate
),
MRB_SYM
(
initialize
)
};
static
const
mrb_irep
new_irep
=
{
3
,
6
,
MRB_IREP_STATIC
,
new_iseq
,
NULL
,
new_syms
,
NULL
,
NULL
,
NULL
,
sizeof
(
new_iseq
),
0
,
2
,
0
,
0
,
};
static
void
static
void
init_class_new
(
mrb_state
*
mrb
,
struct
RClass
*
cls
)
init_class_new
(
mrb_state
*
mrb
,
struct
RClass
*
cls
)
{
{
struct
RProc
*
p
;
struct
RProc
*
p
;
mrb_method_t
m
;
mrb_method_t
m
;
mrb_irep
*
new_irep
=
(
mrb_irep
*
)
mrb_malloc
(
mrb
,
sizeof
(
mrb_irep
));
mrb_sym
*
syms
;
p
=
mrb_proc_new
(
mrb
,
&
new_irep
);
static
const
mrb_irep
mrb_irep_zero
=
{
0
};
*
new_irep
=
mrb_irep_zero
;
syms
=
(
mrb_sym
*
)
mrb_malloc
(
mrb
,
sizeof
(
mrb_sym
)
*
2
);
syms
[
0
]
=
MRB_SYM
(
allocate
);
syms
[
1
]
=
MRB_SYM
(
initialize
);
new_irep
->
syms
=
syms
;
new_irep
->
slen
=
2
;
new_irep
->
flags
=
MRB_ISEQ_NO_FREE
;
new_irep
->
iseq
=
new_iseq
;
new_irep
->
ilen
=
sizeof
(
new_iseq
);
new_irep
->
nregs
=
6
;
new_irep
->
nlocals
=
3
;
p
=
mrb_proc_new
(
mrb
,
new_irep
);
MRB_METHOD_FROM_PROC
(
m
,
p
);
MRB_METHOD_FROM_PROC
(
m
,
p
);
mrb_define_method_raw
(
mrb
,
cls
,
MRB_SYM
(
new
),
m
);
mrb_define_method_raw
(
mrb
,
cls
,
MRB_SYM
(
new
),
m
);
}
}
...
...
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