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
3703aed7
Commit
3703aed7
authored
Mar 20, 2017
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `snprintf()` to stringify fixnum numbers; ref #3492
parent
339c6aed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
10 deletions
+8
-10
mrbgems/mruby-compiler/core/codegen.c
mrbgems/mruby-compiler/core/codegen.c
+8
-10
No files found.
mrbgems/mruby-compiler/core/codegen.c
View file @
3703aed7
...
@@ -2181,13 +2181,13 @@ codegen(codegen_scope *s, node *tree, int val)
...
@@ -2181,13 +2181,13 @@ codegen(codegen_scope *s, node *tree, int val)
case
NODE_BACK_REF
:
case
NODE_BACK_REF
:
if
(
val
)
{
if
(
val
)
{
char
buf
[
2
]
=
{
'$'
};
char
buf
[
3
];
mrb_value
str
;
int
sym
;
int
sym
;
buf
[
0
]
=
'$'
;
buf
[
1
]
=
(
char
)(
intptr_t
)
tree
;
buf
[
1
]
=
(
char
)(
intptr_t
)
tree
;
str
=
mrb_str_new
(
s
->
mrb
,
buf
,
2
)
;
buf
[
2
]
=
0
;
sym
=
new_sym
(
s
,
mrb_intern_
str
(
s
->
mrb
,
str
));
sym
=
new_sym
(
s
,
mrb_intern_
cstr
(
s
->
mrb
,
buf
));
genop
(
s
,
MKOP_ABx
(
OP_GETGLOBAL
,
cursp
(),
sym
));
genop
(
s
,
MKOP_ABx
(
OP_GETGLOBAL
,
cursp
(),
sym
));
push
();
push
();
}
}
...
@@ -2195,14 +2195,12 @@ codegen(codegen_scope *s, node *tree, int val)
...
@@ -2195,14 +2195,12 @@ codegen(codegen_scope *s, node *tree, int val)
case
NODE_NTH_REF
:
case
NODE_NTH_REF
:
if
(
val
)
{
if
(
val
)
{
int
sym
;
mrb_state
*
mrb
=
s
->
mrb
;
mrb_state
*
mrb
=
s
->
mrb
;
mrb_value
fix
=
mrb_fixnum_value
((
intptr_t
)
tree
)
;
char
buf
[
32
]
;
mrb_value
str
=
mrb_str_buf_new
(
mrb
,
4
)
;
int
sym
;
mrb_str_cat_lit
(
mrb
,
str
,
"$"
);
snprintf
(
buf
,
sizeof
(
buf
),
"$%"
PRId64
,
(
intptr_t
)
tree
);
mrb_str_cat_str
(
mrb
,
str
,
mrb_fixnum_to_str
(
mrb
,
fix
,
10
));
sym
=
new_sym
(
s
,
mrb_intern_cstr
(
mrb
,
buf
));
sym
=
new_sym
(
s
,
mrb_intern_str
(
mrb
,
str
));
genop
(
s
,
MKOP_ABx
(
OP_GETGLOBAL
,
cursp
(),
sym
));
genop
(
s
,
MKOP_ABx
(
OP_GETGLOBAL
,
cursp
(),
sym
));
push
();
push
();
}
}
...
...
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